• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Library Constructors

#1
[eluser]USCTrojans[/eluser]
Hey could anyone help me understand the difference between the two different types of constructors available to use with code igniter?


In my c++ course we did constructors for a class by doing the function class() like this:

Code:
class Test {
      
        function Test(){
                constructor here

       }

this works but I have noticed that in code igniter libraries and in php in general you often see this:

Code:
function __construct(){
  parent::__construct();

}

I noticed the second one will overwrite the first one if they are both in a library but what is the difference? Which one should I be using?

Thanks


#2
[eluser]skunkbad[/eluser]
PHP5 = __construct() OR same_name_as_class()

PHP4 = same_name_as_class()


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.