Answers for "cpp make class abstract"

C++
0

cpp make class abstract

struct Abstract
{
     virtual ~Abstract() = 0;
};

Abstract::~Abstract() {}

struct Valid: public Abstract
{
        // Notice you don't need to actually overide the base
        // classes pure virtual method as it has a default
};


int main()
{
    // Abstract        a;  // This line fails to compile as Abstract is abstract
    Valid           v;  // This compiles fine.
}
Posted by: Guest on January-19-2021

Code answers related to "cpp make class abstract"

Browse Popular Code Answers by Language