Sometimes programmers are better versed in code than in English.
The first thing that happens here is the concept of overload. When you create an instance of Bar, the getName () method overloads the method with the same name in Foo.
Overloading is an important and important part of OOD.
However, it is often useful to be able to call a version of a method that exists in the Parent (Foo) class.
Here is an example:
class Dog { public function getTag() { return "I'm a dog."; } } class Skip extends dog { public function getTag() { return Dog::getTag() . " My name is Skip.";
Clearly, this is a very narrow example, but it illustrates the point.
Your base class is the most common type implementation. In this case, it is "Dog." You want to put information in this base class, which is common to all instances of this type. This prevents duplication in each of the Derived classes (for example, "Skip").
Your script uses this function, perhaps inadvertently.
Shane h
source share