+ 1

why not this program output 7 and why it shows compiler error ??? #include<iostream> using namespace std; class a{ public: int f(){cout<<3;} int f(int a){cout<<a;} }; class b:public a { public: int f(){cout<<5;} }; int main() { b obj; obj.f(7); }

1st Sep 2016, 9:22 AM
Lekhraj Singh
Lekhraj Singh - avatar
3 Respuestas
+ 2
And also change the return type of all functions to void as no one is returning any thing
1st Sep 2016, 2:29 PM
abhishek todkar
abhishek todkar - avatar
- 2
Return 0 in main and change the function name in the child class don't save it as f.
1st Sep 2016, 2:28 PM
abhishek todkar
abhishek todkar - avatar
- 5
#include<iostream> between e and < must be space
1st Sep 2016, 1:41 PM
Валера Наумов
Валера Наумов - avatar