what is the correct method for a constructor in a base class and a child class?
for instance i have a class called “Planet” and a subclass “Terran”
it will run fine until i uncomment the “extends planet”
the reason i want it to extend the Planet class is that i want to have functions in all the “Planet Type” classes that are overriding the initial definition in the Planet class, much like virtual functions and abstract base classes in C++
planet code
public class Planet extends Sprite
{
public function Planet ( planetType:uint, posX:Number, posY:Number ):void
{
if ( planetType == 0 )
{
var terran:terran_mc = new terran_mc();
terran.x = posX;
terran.y = posY;
addChild ( terran );
var blah = new Terran();
blah.drawTerran();
}
}
}
terran code
internal class Terran //extends Planet
{
public function drawTerran():void
{
trace("Drawing a terran planet");
}
}