static void Main(string[] args) { Asteroid a = new Asteroid(); ExplodingAsteroid ea = new ExplodingAsteroid(); SpaceShip s = new SpaceShip(); TieFighter tf = new TieFighter(); a.CollideWith(s); a.CollideWith(tf); ea.CollideWith(s); ea.CollideWith(tf); Console.WriteLine(); a = ea; s = tf; a.CollideWith(s); }
public override void CollideWith(SpaceShip s) { s.CollideWith(this); }
public virtual void CollideWith(SpaceShip s) { s.CollideWith(this); }