×

Loading...

See whether this implement what you want:

derived.cpp
#include "Base.h"
class Derived : public Base
{
public:
void did(){cout << "this is derived class" << endl;
cout << "tt = " << getTT() << endl;}
private:
};

base.cpp
#include <iostream.h>
class Base
{
public:
int getTT() { return tt;}
virtual void did(){};
private:
int tt;
};

int main()
{
Base *b = new Derived;
b->did();
return 0;
}
Report

Replies, comments and Discussions: