I am using PHP and iam not understanding the concept of inheritance,I need to access the method in the base class from the inherited class,I created a base class object and called the method using the object,The method was declared in protected mode but now i am not even able to access the methods.Why it is like that?
Any reply is valued the most.
Any reply is appreciated more and also Thanks in adv
please help me I need to solve this problem

Your question has less to do with inheritance and more to do with visibility in php.
(http://www.php.net/manual/en/language.oop5.visibility.php)

Generally speaking:

  • Public - When a method or variable is defined as public it can be called outside the scope of the class or by any class which inherits it.
  • Protected - When a method or variable is defined as protected it can only be called from within the class it was defined or within any class which inherits it.
  • Private - When a method or variable is defined as private it can only be called from the class which it was defined in.

I can elaborate if needed or provide some examples, but there is great beginner information already in the manual or on other tutorial sites.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.