Multiple Type Inheritance in Ada

Suppose I have the following:

type blah is abstract tagged 
record 
element1 : integer; 
end record;

type blah2 is abstract tagged
record
element2 : integer;
end record;

I hope that I can do something like this:

type blah3 is abstract new blah1 and blah 2 with null record;

So, in theory, I can now access blah3.element1 and blah3.element2

Is it possible? and any hints or tips?

UPDATE:

Is it possible to refer to blah3 elements (containing blah and blah2) using pointers?

those. (this is just an approximate idea code is terrible ... LOL)

type blah3 is new type with
record
element1 : ptr to blah.element1;
element2 : ptr to blah2.element2;
end record

and then they can be obtained through For example, blah3.element1?

+3
source share
1 answer

Mark C is correct (as usual).

, . , , , . Ada95 , .

, ", , ?"

, , . ( ) , "mixin". , , AdaIC: Ada95 , .

:

Ada 95 ( "" / "use" ) "-" , , .

, Ada 2005 ( "" ), . ( , MI - Ada) . . , , Ada 2005

Interfaces can be composed from other interfaces thus 
type Int2 is interface;
...
type Int3 is interface and Int1;
...
type Int4 is interface and Int1 and Int2;
...
+4

Source: https://habr.com/ru/post/1735283/


All Articles