(Sep-23-2021, 12:31 PM)mr_byte31 Wrote: I am just wondering why there exists two solutions for the same problem.well, these are two completely different concepts.
Class is a blue-print. Very rough comparison between the two:
Instantiation is creating multiple items (i.e. instances) based on the same blue print. All instances of the same class have exactly the same attributes.
Inheritance is when one class have some attributes from the parent class (or classes in case of multiple inheritance), but at the same time extend the parent class with new attributes or overload some attributes with different implementation.
e.g. having class Animal and then class Mammal, class Bird and class Reptile, etc. that inherit from it. You will instantiate child class if you need an object that is instance of e.g. class Mammal.
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs