From: deuteros <deuteros@xrs.net>
Subject: Assigning a "subclass" instance to a "superclass" variable
Date: Fri, 6 Apr 2012 20:49:41 +0000 (UTC)
Date: 2012-04-06T20:49:41+00:00 [thread overview]
Message-ID: <jlnkt5$91i$1@dont-email.me> (raw)
I'm still trying to understand how Ada does object orientation. In Java I could
do this:
Class Animal
{
String color;
public Animal(String color)
{
this.color = color;
}
}
Class Dog extends Animal
{
public Dog(String color)
{
super(color);
}
}
So in Ada I'm trying to achieve something similar with my Statement
package:
package Statements is
type Statement is abstract tagged
record
tokens : Vector;
executedtokens : Vector;
end record;
type Statement_Access is access all Statement'Class;
function execute(skip: in Boolean; S: in Statement) return Integer is abstract;
end Statements;
So when I create a child of Statement, how to I set up the .ads file?
next reply other threads:[~2012-04-06 20:49 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-06 20:49 deuteros [this message]
2012-04-06 21:50 ` Assigning a "subclass" instance to a "superclass" variable Simon Wright
2012-04-06 23:13 ` deuteros
2012-04-07 7:06 ` Simon Wright
2012-04-07 7:06 ` Dmitry A. Kazakov
2012-04-07 7:08 ` Niklas Holsti
2012-04-07 10:18 ` Georg Bauhaus
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox