learn structure of the child and parrent to be abel to use them inside eachother if that even i understand right ?
Polymorphism: Your sub class has everything your base class has. If your sub class is empty, you basically get the same base class again, except private things. Private is not accessible from subclass. Additionally, if you override (or hide, just for the record - don't use it!) a method of the base class in your sub class the behaviour is that of the sub class (you can call the base class method tho). So for example if you have an animal class with a method "eat()" then all animals, especially the dog sub class, will have that method available.
Обсуждают сегодня