Message from C, C++ discussions
January 2020
— Do i have to implement it in base class?
To make a class abstract you need to declare at least one member function as pure virtual:virtual foo() = 0;
— And you need to declare a destructor to be virtual virtual ~MyClass() = default;
— C#?
— C++
— Is this necessary for making a class abstract
?
— Even though without this may lead to some random behaviour at times when you delete the derived object using Base's pointer.
— It's necessary for making class polymorphic and behave correctly
— Yes
— BTW, polymorphic classes are those which have a virtual function or inherit one. Right?
— So both base and derived come are polymorphic?
— Never send an entire project. Just a code snippet that reproduces your problem. Also, by doing that every time you a face a bug, you normally end up finding it before asking for help