I am learning about class inheritance and need some help with the code below. I have two classes:
Product and Book.
In my Book class I have a line:
MyBase.new(code, description, price)
I am getting an error on that line stating:
Too many arguments to Public Sub New()
Can someone tell me why I am getting such an error?
Thanks
Code:Public Class Product Private m_Code As String Private m_Description As String Private m_Price As Decimal Public Property Code() As String Get Return m_Code End Get Set(ByVal value As String) m_Code = value End Set End Property Public Property Description() As String Get Return m_Description End Get Set(ByVal value As String) m_Description = value End Set End Property Public Property Price() As Decimal Get Return m_Price End Get Set(ByVal value As Decimal) m_Price = value End Set End Property Public Overridable Function GetDisplayText(ByVal sep As String) As String Return Code & sep & Description & sep & FormatCurrency(Price).ToString End Function End Class Public Class Book Inherits Product Public Author As String Public Sub New(ByVal code As String, ByVal description As String, ByVal author As String, ByVal price As Decimal) MyBase.new(code, description, price) Me.Author = author End Sub End Class




Reply With Quote