abstract class - Pure virtual methods in C#? -
i've been told make class abstract:
public abstract class airplane_abstract
and make method called move virtual
public virtual void move() { //use property ensure there valid position object double radians = planeposition.direction * (math.pi / 180.0); // change x location x vector of speed planeposition.x_coordinate += (int)(planeposition.speed * math.cos(radians)); // change y location y vector of speed planeposition.y_coordinate += (int)(planeposition.speed * math.sin(radians)); }
and 4 other methods should "pure virtual methods." exactly?
they right now:
public virtual void turnright() { // turn right relative airplane if (planeposition.direction >= 0 && planeposition.direction < position.max_compass_direction) planeposition.direction += 1; else planeposition.direction = position.min_compass_direction; //due north }
my guess whoever told write "pure virtual" method c++ programmer rather c# programmer... equivalent abstract method:
public abstract void turnright();
that forces concrete subclasses override turnright
real implementation.
Comments
Post a Comment