c# inheritance help -


i new inheritance , wanted ask something. have base class has lots of functionality shared number of derived classes.

the difference each derived class single method called name. functionality same each derived class, there need name distinction.

i have property in base class called name. how arrange derived classes can each override base class property?

thanks.

declare method virtual

public class {     public virtual string name(string name)     {         return name;     } } public class b : {     public override string name(string name)     {         return base.name(name); // calling a's method     } } public class c : {     public override string name(string name)     {         return "1+1";     } } 

Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

html - Instapaper-like algorithm -

c# - How to execute a particular part of code asynchronously in a class -