Page 198 - Open Soource Technologies 304.indd
P. 198

Web Technologies-I



                   Notes         Here are some sample classes and objects that exercise the introspection functions from Example:
                                 class A
                                 {

                                 var $foo = ‘foo’;
                                 var $bar = ‘bar’;

                                 var $baz = 17.0;
                                 function first_function( )
                                 {
                                 }

                                 function second_function( )
                                 {

                                 }
                                 };
                                 class B extends A
                                 {

                                 var $quux = false;
                                 function third_function( )
                                 {

                                 }
                                 };
                                 class C extends B

                                 {
                                 };
                                 $a = new A;

                                 $a->foo = ‘sylvie’;
                                 $a->bar = 23;
                                 $b = new B;

                                 $b->foo = ‘bruno’;
                                 $b->quux = true;
                                 $c = new C;

                                 print_object_info($a);
                                 print_object_info($b);
                                 print_object_info($c);

                                 Figure 8.2 shows the output of this code.





        192                               LOVELY PROFESSIONAL UNIVERSITY
   193   194   195   196   197   198   199   200   201   202   203