Exemple #1
0
    public static void Main(string[] args)
    {
        System.Console.WriteLine("Let's create a Ball.");
        //IBall ball = (IBall) Factory.BallClass(); // TODO should be using this line. (?really?)
        Ball ball = new Ball();

        System.Console.WriteLine("bouncing ball.");
        ball.bounce();
        System.Console.WriteLine("Rolling ball by 3.");
        ball.roll(3);
        System.Console.WriteLine("Rolling ball by 4.");
        int dist;
        dist = ball.roll(4);
        System.Console.WriteLine("Ball was rolled a total of " + dist + ".");
    }