Open jimin-kiim opened 2 years ago
in OOP
💡 thinking in terms of objects and classes is much easier for humans
subclass
= derived class
= child class
superclass
= base class
= parent class
Extension
Contraction
void Parent::example(int a)
{
 cout << "in parent code\n";
}
void Child::example(int a) {  Parent::example(12); // do parent code  cout << "in child code\n"; // then child code }
### Polymorphic variable
- a variable declared as one type but in fact holds a value of different type
- can reference more than one type of object
- derives their power from interaction with inheritance, overriding and substitution
- when a method is overridden, the code executed will be determined by the current value of a polymorphic variable, not its declared type
- this : example of common polymorphic variable
### Generics (templates)
- a way of creating general tools or classes by parameterizing on types (not values)
- developing code by leaving certain key types unspecified, to be filled in later
- both used with functions and with classes
- [function template](https://github.com/jimin-kiim/CPP/issues/16#issuecomment-1352937437)
- [class template](https://github.com/jimin-kiim/CPP/issues/16#issuecomment-1352937578)
Encapsulation
,Information Hiding
(w. interface and implementation)Inheritance
Polymorphism