A
Anees
Dear Fellows:
I am using visual studio 2008. Can anyone help, why does the following
polymorphism not working? It is keep giving "base" as output
#include <iostream>
using namespace std;
class base {
public:
base() {
print();
}
protected:
virtual void print() {
cout << "base" << endl;
}
};
class derivedublic base {
protected:
virtual void print() {
cout << "derived" << endl;
}
};
int _tmain(int argc, _TCHAR* argv[]){
derived d;
}
I am using visual studio 2008. Can anyone help, why does the following
polymorphism not working? It is keep giving "base" as output
#include <iostream>
using namespace std;
class base {
public:
base() {
print();
}
protected:
virtual void print() {
cout << "base" << endl;
}
};
class derivedublic base {
protected:
virtual void print() {
cout << "derived" << endl;
}
};
int _tmain(int argc, _TCHAR* argv[]){
derived d;
}