Creating abstract device class

I need a class which should work as a “template” device for “sub-devices”. My first idea was to use abstract classes, however I tried this:

switch_choice_handler := class<abstract>(creative_device):

But it gave this error: (which is expected)
concrete classes must not be abstract. concreteclass switch_choice_handler isabstract`.(3632)

So basically, I am abstractifying a device I already have so that it can take in any subclass-device that inherits this main template, and use the shared functions that they all take from the parent class.

How can I achieve this? Thanks in advance!

Something you can do is make your base device have default functions (for void-returning ones you can use {} or block:), subclasses can then override them. It’s not as “pretty” as having an abstract class but that’s the next best thing in this scenario.

2 Likes