Most of this was just a recap on ADS.
OOP in Ada
We wont use OOP in Ada too much. Thankfully. It’s based on type extensions and dynamic polymorphism. So you can do something like:
type EA is tagged record ... end record; -- tagged type
procedure Op1(E : EA; Other_Param : Param);
-- primitive operation
procedure Op2(E : EA; Other_Param : Param);
--- primitive operation
type EEA is new EA with record ... end record; -- inherit OP1
overrides
procedure Op2(E : EEA; Other_Param : Param);
-- override Op2
procedure Op3(E : EEA; Other_Param : Param);
-- add new primitive operation
type EEEA is new EEA ...
type EAE is new EA ...
type EAEE is new EAE ...
procedure Generic_Call(X : EA’Class) is
begin
OP1(X,Param);
X.OP1(Param);-- Ada 2005
end Generic_Call;
Standard example of ‘coordinates’ in slides.