I'm trying to figure out how to override the value of a propery for a parent class in a child class.
C#
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?
Kiran14 pointsPosted May 19, 2008, 1:07 PM EDT
It shouldn't throw a compiler error if you have derived the Child from Base like
public class Child : Base
I don't think you can override constants.
HTH