-2

I have an Abstract Class and I need to create two anonymous subclasses objects for it. I have multiple subclasses. Just write the code to create one of these objects

1 Answers1

3

When you declare a class (or structure) the name of the class optional if you declare a variable, but you can still use inheritance.

Something like

class AbstractBaseClass
{
public:
    virtual void abstract_function() = 0;
};

class : public AbstractBaseClass
{
public:
    void abstract_function() { ... }
} my_anonymous_object;
Some programmer dude
  • 400,186
  • 35
  • 402
  • 621