Overriding and Inheritance in C#

后端 未结 8 2195
时光说笑
时光说笑 2020-12-10 10:49

Ok, bear with me guys and girls as I\'m learning. Here\'s my question.

I can\'t figure out why I can\'t override a method from a parent class. Here\'s the code fro

8条回答
  •  一生所求
    2020-12-10 11:23

    You need to tell C# that your object is overriding the function from the base class.

    Here is the MSDN article about the syntax you need: http://msdn.microsoft.com/en-us/library/ebca9ah3(VS.71).aspx

    public class SadObject: MoodyObject    
    {        
        override String getMood()
    

提交回复
热议问题