Data update
This commit is contained in:
parent
5150844a7d
commit
4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions
|
|
@ -1,8 +0,0 @@
|
|||
package My_Class is
|
||||
type Object is tagged private;
|
||||
procedure Primitive(Self: Object); -- primitive subprogram
|
||||
procedure Dynamic(Self: Object'Class);
|
||||
procedure Static;
|
||||
private
|
||||
type Object is tagged null record;
|
||||
end My_Class;
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
package body My_Class is
|
||||
procedure Primitive(Self: Object) is
|
||||
begin
|
||||
Put_Line("Hello World!");
|
||||
end Primitive;
|
||||
|
||||
procedure Dynamic(Self: Object'Class) is
|
||||
begin
|
||||
Put("Hi there! ... ");
|
||||
Self.Primitive; -- dispatching call: calls different subprograms,
|
||||
-- depending on the type of Self
|
||||
end Dynamic;
|
||||
|
||||
procedure Static is
|
||||
begin
|
||||
Put_Line("Greetings");
|
||||
end Static;
|
||||
end My_Class;
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
package Other_Class is
|
||||
type Object is new My_Class.Object with null record;
|
||||
overriding procedure Primitive(Self: Object);
|
||||
end Other_Class;
|
||||
|
||||
package body Other_Class is
|
||||
procedure Primitive(Self: Object) is
|
||||
begin
|
||||
Put_Line("Hello Universe!");
|
||||
end Primitive;
|
||||
end Other_Class;
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
with Ada.Text_IO; use Ada.Text_IO;
|
||||
|
||||
procedure Call_Method is
|
||||
|
||||
package My_Class is ... -- see above
|
||||
package body My_Class is ... -- see above
|
||||
|
||||
package Other_Class is ... -- see above
|
||||
package body Other_Class is ... -- see above
|
||||
|
||||
Ob1: My_Class.Object; -- our "root" type
|
||||
Ob2: Other_Class.Object; -- a type derived from the "root" type
|
||||
|
||||
begin
|
||||
My_Class.Static;
|
||||
Ob1.Primitive;
|
||||
Ob2.Primitive;
|
||||
Ob1.Dynamic;
|
||||
Ob2.Dynamic;
|
||||
end Call_Method;
|
||||
Loading…
Add table
Add a link
Reference in a new issue