Abstract Classes and ReadOnly Properties

Posted by serhio on Stack Overflow See other posts from Stack Overflow or by serhio
Published on 2011-01-12T18:55:22Z Indexed on 2011/01/13 10:53 UTC
Read the original article Hit count: 186

Filed under:
|
|
|

Let's have three classes;

Line
PoliLine
SuperPoliLine

for all that three classes a Distance is defined.

But only for the Line a Distance can be Set.

Is there a possibility to build a common abstract (MustInherit) class Segment, having a Distance as (abstract +? ReadOnly) member?

Question for VB.NET, but C# answers welcomed too.


Business Background

Imagine a Bus. It has a lot of Stations, MainStations, and 2 TerminalStations. So Line is between 2 Stations, PoliLine is between 2 MainStations, and SuperPoliLine is between 2 TerminalStations. All "lines" are "Segments", but only the distance A->B between 2 stations - Line can be defined.

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET