oo-70-245-1

oo-70-245-1 Git Source Tree


Root/Powerpoint Examples/Powerpoint 2/p3-class-inherit-override.cs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
using System;
 
class P2 {
    static void Main()
    {
        cDog ob2 = new cDog();
        cMammal ob1 = (cMammal)ob2;
        ob1.speak();
        ob2.speak();
    }
}
 
class cMammal {
    public virtual void speak()
    {
        Console.WriteLine("Grunt");
    }
}
 
class cDog : cMammal {
    public override void speak()
    {
        Console.WriteLine("woof woof");
    }
}

Archive Download this file

Branches

Number of commits:
Page rendered in 0.10335s using 11 queries.