create an abstract class in matlab

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.m
classdef MyAbstractClass
    methods (Abstract)
        foo(obj);
    end
end
78 chars
6 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.

related categories

gistlibby LogSnag