コード例 #1
0
ファイル: Program.cs プロジェクト: agraphe/C-Sharp-3.0
 public void Run()
 {
     // assign derived instance to base reference
     Telephone phone1 = new DigitalPhone();
     Telephone phone2 = new TalkingPhone();
     phone1.Ring(); // accessing the polymorphic method
     phone2.Ring(); // accessing the polymorphic method
 }
コード例 #2
0
        public void Run()
        {
            // assign derived instance to base reference
            Telephone phone1 = new DigitalPhone();
            Telephone phone2 = new TalkingPhone();

            phone1.Ring(); // accessing the polymorphic method
            phone2.Ring(); // accessing the polymorphic method
        }