+ 1
Inheritance in OOP
Can anyone teach me how to use special functions (friend, copy constructor, destructor,...) of base class in derived class??? (>>, <<, +, =, ...) Thanks
1 Resposta
+ 3
For constructor, you can just call super() in your derived class constructor.
For methods, you can create an object and call the method using that object.
For eg.
int x= obj.sum(); where obj is object, x is any variable and sum() is parent class method.
Or you can simply use super() keyword for calling method.
For eg.
int x= super.sum();
OOP basic concepts always remains same with fluctuations based on language regarding keywords or kind of Inheritance etc.