Changes between Version 5 and Version 6 of jazz/21-09-22


Ignore:
Timestamp:
Oct 10, 2021, 10:38:25 AM (3 years ago)
Author:
jazz
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • jazz/21-09-22

    v5 v6  
    5151}
    5252}}}
     53{{{
     54#!C#
     55using System.IO;
     56using System;
     57
     58class Program
     59{
     60    static void Main()
     61    {
     62        Console.WriteLine("Hello, World!");
     63        Animal animal = new Cat();
     64        animal.who_am_i();
     65        animal = new Kitten();
     66        animal.who_am_i();
     67    }
     68}
     69
     70abstract class Animal
     71{
     72    public abstract void who_am_i();
     73}
     74
     75class Cat:Animal
     76{
     77    public override void who_am_i() {
     78        Console.WriteLine("I'm a Cat");
     79    }
     80}
     81
     82class Kitten:Cat
     83{
     84    public override void who_am_i() {
     85        Console.WriteLine("I'm a Kitten");
     86    }
     87}
     88}}}