Multiple inheritance - how do I get this to compile?

A

Angus

#include <iostream>


class CBase
{
public:
virtual int Validate()
{
std::cout << "CBase::Validate" << std::endl;
return 0;
}
};


class CDerived1 : public virtual CBase
{
public:
virtual int Validate()
{
std::cout << "CDerived1::Validate" << std::endl;
return 0;
}
};

class CDerived2 : public virtual CBase
{
public:
virtual int Validate()
{
std::cout << "CDerived2::Validate" << std::endl;
return 0;
}
};

class Diamond : public CDerived1, public CDerived2
{
public:

};


int main()
{
Diamond rq;
rq.Validate();

return 0;
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,981
Messages
2,570,188
Members
46,733
Latest member
LonaMonzon

Latest Threads

Top