A
Antuane
I've got a class as follows,
PUBLIC CLASS BaseClass
Sub New()
End Sub
Sub New(byval cName as String)
End Sub
Sub New(byval cName as String, nAge as Int16)
End Sub
END CLASS
PUBLIC CLASS Person
Inherits BaseClass
END CLASS
** Coding
If suppose i try the following piece of coding,
Dim oPerson as New Person("Jack", "Daniels")
"Then i get an error saying that the NEW method cannot accecpt so may
parameters
1. What have i done wrong?
2. I want to define such base NEW() - constructors, & do'nt want to write
these coding out in the subclasses.
But it seems taht i have to do so.
2. Is is possible for me to restrict the Sub NEW() contructor - the one
wihout parameters.
i.e. what i want to do is, when initializing the Person class, i want to
make it impossible to initialize this class by using the New() constructor
without any paramters.
Right now, what i do is,
PUBLIC CLass Person
Sub New()
THROW New Exception("Try using the Other Constructors which
accept parameters")
End Sub
.....
Is there another way of achieving the above?????
PUBLIC CLASS BaseClass
Sub New()
End Sub
Sub New(byval cName as String)
End Sub
Sub New(byval cName as String, nAge as Int16)
End Sub
END CLASS
PUBLIC CLASS Person
Inherits BaseClass
END CLASS
** Coding
If suppose i try the following piece of coding,
Dim oPerson as New Person("Jack", "Daniels")
"Then i get an error saying that the NEW method cannot accecpt so may
parameters
1. What have i done wrong?
2. I want to define such base NEW() - constructors, & do'nt want to write
these coding out in the subclasses.
But it seems taht i have to do so.
2. Is is possible for me to restrict the Sub NEW() contructor - the one
wihout parameters.
i.e. what i want to do is, when initializing the Person class, i want to
make it impossible to initialize this class by using the New() constructor
without any paramters.
Right now, what i do is,
PUBLIC CLass Person
Sub New()
THROW New Exception("Try using the Other Constructors which
accept parameters")
End Sub
.....
Is there another way of achieving the above?????