+ 1

Inheritance in OOP

Can anyone teach me how to use special functions (friend, copy constructor, destructor,...) of base class in derived class??? (>>, <<, +, =, ...) Thanks

17th Jun 2019, 9:54 AM
Phuong Anh Lam Ngoc
Phuong Anh Lam Ngoc - avatar
1 Réponse
+ 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.
25th Jun 2019, 11:40 AM
Chetali Shah
Chetali Shah - avatar