JEV
JEV

Reputation: 2504

vb.net Interface and a Classes

I have a class which has a variety of details, as follows:

Vehicle Name Vehicle Address

VEHICLE Percentage: 10

I need to somehow use an Interface for another version, SpecialVehicle.

Special Vehicle has a different Percentage, for example 15.

How can I integrate that in an interface? I just don't understand them?

Upvotes: 0

Views: 84

Answers (1)

Ry-
Ry-

Reputation: 224867

You probably wouldn't use an interface; you would just inherit from Vehicle. Assuming Percentage is a Public Overridable ReadOnly Property Percentage() As Integer (if it's not Overridable and a Property, make it so), override it in SpecialVehicle like so:

Public Overrides ReadOnly Property Percentage() As Integer
    Get
        Return 15
    End Get
End Property

Upvotes: 2

Related Questions