comp.lang.ada
 help / color / mirror / Atom feed
* Assigning a "subclass" instance to a "superclass" variable
@ 2012-04-06 20:49 deuteros
  2012-04-06 21:50 ` Simon Wright
  2012-04-07 10:18 ` Georg Bauhaus
  0 siblings, 2 replies; 7+ messages in thread
From: deuteros @ 2012-04-06 20:49 UTC (permalink / 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?



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-04-07 10:18 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-06 20:49 Assigning a "subclass" instance to a "superclass" variable deuteros
2012-04-06 21:50 ` 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox