How to have abstract and overriding constants in C#?

If your constant is describing your object, then it should be a property. A constant, by its name, should not change and was designed to be unaffected by polymorphism. The same apply for static variable.

You can create an abstract property (or virtual if you want a default value) in your base class:

public abstract string Bank { get; }

Then override with:

public override string Bank { get { return "Some bank"; } }

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)