05/06_Interface.php
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
2 <html>
3 <head>
4 <meta http-equiv="Author" content="Imrich BURANSKY" />
5 <meta http-equiv="Content-Type" content="text/html; charset=Windows-1250" />
6 <title>Interface</title>
7 </head>
8 <body>
9 <div>
10 <h2>Interface</h2>
11 <?php
12 interface I1
13 {
14 function F1_I1();
15 }
16 interface I2
17 {
18 abstract public function F1_I2();
19 }
20
21 abstract class CA
22 {
23 abstract public function FA ();
24 }
25
26 class CA1 extends CA implements I1, I2
27 {
28 public function __construct()
29 {
30 echo "CA1: Konštruktor<br />\n";
31 }
32
33 public function FA ()
34 {
35 echo "CA1: Funkcia FA<br />\n";
36 }
37
38 public function F1_I1 ()
39 {
40 echo "CA1: Funkcia F1 rozhrania I1<br />\n";
41 }
42
43 public function F1_I2 ()
44 {
45 echo "CA1: Funkcia F1 rozhrania I2<br />\n";
46 }
47 }
48 echo "<b>Vytvorenie a použitie objektu \$A1 triedy CA1</b><br />\n";
49 $A1 = new CA1(); // CA1: Konštruktor
50 $A1->FA(); // CA1: Funkcia FA
51 $A1->F1_I1(); // CA1: Funkcia F1 rozhrania I1
52 $A1->F1_I2(); // CA1: Funkcia F1 rozhrania I2
53
54 ?>
55 </div>
56 </body>
57 </html>