Object-oriented programming.
For example, independent classes could define Dogs and Cats, and a Chimera object
could be created from these two which inherits all the (multiple) behavior of cats and
dogs. This is not always supported, as it can be hard both to implement and to use
well.
Example
DEFINITION MODULE Counter;
PROCEDURE InitialiseCounter(InitialValue: INTEGER);
PROCEDURE IncrementCounter;
PROCEDURE GetCounterValue(): INTEGER;
END Counter.
IMPLEMENTATION MODULE Counter;
VAR MyCounter: INTEGER;
PROCEDURE InitialiseCounter(InitialValue: INTEGER);
BEGIN
MyCounter := InitialValue;
END InitialiseCounter;
PROCEDURE IncrementCounter;
BEGIN
INC(MyCounter);
END IncrementCounter;
PROCEDURE GetCounterValue(): INTEGER;
BEGIN
RETURN MyCounter;
END GetCounterValue;
BEGIN
MyCounter := 0;
END Counter.
Summary
OOP can be used to translate from real-world phenomena to program elements (and
vice versa). OOP was even invented for the purpose of physical modeling in the