In MATLAB, you can create an abstract class by setting at least one of its methods as abstract using the Abstract
keyword. Abstract methods are methods without implementation and must be implemented by the child classes that derive from the abstract class. Here is an example:
main.m78 chars6 lines
In this example, we define an abstract class MyAbstractClass
with one abstract method foo
.
Note that you cannot create an object of an abstract class; you can only create objects of its non-abstract subclasses.
gistlibby LogSnag