1
Answer

Inheritance of class properties

Luke

Luke

16y
2k
1

I'm trying to figure out how to override the value of a propery for a parent class in a child class.

For example, i have

   public class Base

   { public virtual string _Caption="parentresult";}

   public class Child

   { public override string _Caption="childresult";}

But the virtual and override keywords raise errors during compilation.  They work if i setup accessors, but I shouldn't have to do that (should I?).

Is it possible to make them consts, also?

Answers (1)