Intellisense not working with abstract class

When I create an inherited class

For example :

class Base {public: virtual void foo() = 0;};

class Derived :public Base{void foo() override { }}

std::vector < Base > Objects; // <-- This does not error here even though the base object cannot be constructed.

std::vector < Base* > Objects; // <-- This is the right way to do it.

 

1 comment
Comment actions Permalink

When I create an inherited class

For example :

class Base {public: virtual void foo() = 0;};

class Derived :public Base{void foo() override { }}

Liteblue

std::vector < Base > Objects; // <-- This does not error here even though the base object cannot be constructed.

std::vector < Base* > Objects; // <-- This is the right way to do it.

Using inheritance, we have to write the functions only one time instead of three times as we have inherited rest of the three classes from base class (Vehicle).

0

Please sign in to leave a comment.