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; } };
1 Answer
+ 1
x+2
because you specify the same name function...