+ 2
What is the difference between inheritence and override?
3 Answers
+ 2
If you don't know, please don't reply, otherwise people will think the question has been answered.
When a class inherits from another class (they are called the derived class and the base class respectively), the derived class gets access to all public and protected attributes and methods of the base class.
The derived class can redefined its own implementation of a method of the base class that will override it. For example, class B inherits from class A, and class A has a foo() method. In the definition of class B, we can redefine a foo() method with a different behavior (overriding it), and this is this method that will be called when calling foo() on a B object. If you don't override foo(), calling foo() on a B object will call the inherited foo() of class A.
+ 1
I don't know. I'm so sorry
- 2
idk too