I'm wondering if the following is possible. I wanted my derived class dA
to change func()
to be pure virtual so that any classes derived from dA
must implement func()
.
Code similar to below compiles without complaint under MSVC even though ddA
does not implement func()
.
The compiler does complain about the below code (see comments). So my question now becomes: is this a standards-compliant way to achieve what I want?
class A {
public:
virtual void func() { /* Some base implementation. */ }
}
class dA : public A {
public:
void func() override = 0; // Is this valid?
}
class ddA : public dA {
}