what will be output is function with same parameters and same return type is used in derived class | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

what will be output is function with same parameters and same return type is used in derived class

class A { public: int f(int x) { cout<<x; } }; class B:public A { public: int f(int x) { cout<<x+2; } };

4th Aug 2017, 4:01 PM
Siddharth K
Siddharth K - avatar
1 Answer
+ 1
x+2 because you specify the same name function...
10th Aug 2017, 5:41 PM
Niar
Niar - avatar