Wednesday, 11 December 2013

Object

           Objects are instances of a class.So the process of instantiating the class provides an object.We can create unlimited times of objects with a class.
           When we are creating an object... that is instantiating a class starts with a keyword of  'new'.

Example:

             <?php     include("myclass.php");    ?>




              <head>







                <!-- head contents -->
              </head>
              <body>
              <?php
                   $pen=new pencilbox();
                ?>
               </body>
Explanation:
  • First include the class file
  • Then call instantiating function where you need it in the program....
  • Here $pen is the object  instantiated from the class pencilbox().

No comments:

Post a Comment