Here is the Interface Class
Expand|Select|Wrap|Line Numbers
- Public Interface IShipmentProvider
- ReadOnly Property ProviderName As String
- ReadOnly Property ShipmentItems As ICollection(Of Package)
- Function GetRates() As ICollection(Of Rate)
- Function VerifyAddress(ByVal address As Address) As ICollection(Of Address)
- End Interface
Expand|Select|Wrap|Line Numbers
- Public Class FedExShipmentProvider
- Implements IShipmentProvider
- Public Function GetRates() As ICollection(Of Rate) Implements IShipmentProvider.GetRates
- Throw New NotImplementedException
- End Function
- Public ReadOnly Property ProviderName As String Implements IShipmentProvider.ProviderName
- Get
- Return "FedEx"
- End Get
- End Property
- Public ReadOnly Property ShipmentItems As ICollection(Of Package) Implements IShipmentProvider.ShipmentItems
- Get
- Return _lstofItems
- End Get
- End Property
- Public Function VerifyAddress(address As Address) As ICollection(Of Address) Implements IShipmentProvider.VerifyAddress
- Throw New NotImplementedException
- End Function
- End Class
- Public Class USPSShipmentProvider
- Implements IShipmentProvider
- Public Function GetRates() As ICollection(Of Rate) Implements IShipmentProvider.GetRates
- Throw New NotImplementedException
- End Function
- Public ReadOnly Property ProviderName As String Implements IShipmentProvider.ProviderName
- Get
- Return "USPS"
- End Get
- End Property
- Public ReadOnly Property ShipmentItems As ICollection(Of Package) Implements IShipmentProvider.ShipmentItems
- Get
- Return _lstofItems
- End Get
- End Property
- Public Function VerifyAddress(address As Address) As ICollection(Of Address) Implements IShipmentProvider.VerifyAddress
- Throw New NotImplementedException
- End Function
- End Class
- Public Class UPSShipmentProvider
- Implements IShipmentProvider
- Public Function GetRates() As ICollection(Of Rate) Implements IShipmentProvider.GetRates
- Throw New NotImplementedException
- End Function
- Public ReadOnly Property ProviderName As String Implements IShipmentProvider.ProviderName
- Get
- Return "UPS"
- End Get
- End Property
- Public ReadOnly Property ShipmentItems As ICollection(Of Package) Implements IShipmentProvider.ShipmentItems
- Get
- Return _lstofItems
- End Get
- End Property
- Public Function VerifyAddress(address As Address) As ICollection(Of Address) Implements IShipmentProvider.VerifyAddress
- Throw New NotImplementedException
- End Function
- End Class
Now let just say I am supposed to add additional functionality of generating shipping label. How do I add the function of creating label to the interface class and implementations without breaking any other implementations. If I add the function directly to the interface then I will run into issue of breaking all the existing implementations unless I update all of them. Is there a way we can add the functionality with out breaking or updating existing implementations.
Please direct me to the right directions.
Thank you in advance.