Consider the following scenario: Class A defines many virtual functions. Class B and class C inherit from class A, but I want some virtual functions in class A to be available only in class B and not in class C.
I wrote the following code to try it out:
class A
{
public:
A() { }
virtual void play()
{
printf("A::play() \n");
}
};
class B : public A
{
public:
B() { }
virtual void play() = delete;
private:
};
The error is as follows: error C2282: "B::play" cannot be overwritten "A::play"
Aucun commentaire:
Enregistrer un commentaire