Whats wrong with the following code, its not compiling
- by Ganesh Kundapur
#include <iostream>
#include <vector>
using namespace std;
class Base
{
public:
void Display( void )
{
cout<<"Base display"<<endl;
}
int Display( int a )
{
cout<<"Base int display"<<endl;
return 0;
}
};
class Derived : public Base
{
public:
void Display( void )
{
cout<<"Derived display"<<endl;
}
};
void main()
{
Derived obj;
obj.Display();
obj.Display( 10 );
}
$test1.cpp: In function ‘int main()’:
test1.cpp:35: error: no matching function for call to ‘Derived::Display(int)’
test1.cpp:24: note: candidates are: void Derived::Display()
On commenting obj.Display(10), it works.