Results 1 to 4 of 4

Thread: Does PHP5 Inheritance has different features that PHP4

  1. #1
    Join Date
    Oct 2008
    Posts
    116

    Does PHP5 Inheritance has different features that PHP4

    I am aware about the functioning of Inheritance in different language and it's syntax remains the same but recently I have installed PHP5 and working on that I have not also even work on PHP4 but I read about the Inheritance in PHP4 so I just wanted to ask the Inheritance in php5 remains the same or it has any significant changes.

  2. #2
    Join Date
    Jan 2006
    Posts
    211

    Re: Does PHP5 Inheritance has different features that PHP4

    The object oriented features of PHP 5 are leaps and bounds more complete than PHP 4. Inheritance is the mechanism of deriving a new class from an existing class. It allows a sub-class / child class to share/inherit the attributes and behaviors of a base-class or parent class. In fact, PHP 5 could almost pass for a true object oriented language in many ways: visibility, overloading, reflection, etc.

  3. #3
    Join Date
    Feb 2006
    Posts
    90

    Re: Does PHP5 Inheritance has different features that PHP4

    PHP 5 is very very flexible in accessing member variables and member functions. Access specifiers specify the level of access that the outside world (other objects and functions) have on the data members / member functions of the class. You cannot type hint string or int/integer in a method signature. Please note that all data members and member functions are public by default. So, while interfaces certainly have their place, and I know the complications that true (C++) multiple inheritance can add, something in the middle would be nice, in both Java and PHP.

  4. #4
    Join Date
    Jan 2009
    Posts
    134

    Re: Does PHP5 Inheritance has different features that PHP4

    In general, I believe the whole point of interfaces over MI is that MI is evil, so you shouldn't try to route around the language or you'll end up shooting yourself in the foot. A private access specifier is used to hide data and member functions. A method or data member declared as private can only be accessed by the class itself and neither the outside program nor the derived class can have access to it.

Similar Threads

  1. PHP5 - PHP login registration help
    By Orlando in forum Software Development
    Replies: 5
    Last Post: 01-05-2011, 03:24 AM
  2. Replies: 3
    Last Post: 08-01-2011, 06:32 AM
  3. Difference between PHP4 and PHP5
    By Balamohan in forum Software Development
    Replies: 5
    Last Post: 30-12-2009, 05:05 AM
  4. Abstract Classes in PHP5
    By nonose in forum Software Development
    Replies: 2
    Last Post: 16-06-2009, 02:33 PM
  5. Destructor in PHP5
    By Duck in forum Software Development
    Replies: 3
    Last Post: 18-03-2009, 12:01 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,711,662,143.51742 seconds with 17 queries