OK I came up with a work around if anyone cares.
create a mustoverride method in class A ex (fillClassVariables). In each of
my constructors for class A I will call that fillClassVariables. In class
b, in the fillClassVariables method, fill in the variables I need. This
makes it so I do not need to recreate my constructors.
example
Class A
protected myVar as string
protected mustoverride function fillClassVariables
public sub new()
fillClassVariables
'do stuff
end sub
public sub new(var1)
fillClassVariables
'do stuff
end sub
public sub new(var1,var2)
fillClassVariables
'do stuff
end sub
END Class
Class B
inherits A
protected overrides function fillclassvariables
myVar = "Class B"
end function
End Class
"Larry Lard" <la*******@hotmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
Altman wrote: I have a class that I want many others inherited off of. I have created
a
variable in the parent class that I want the inherited classes to set.
But
I do not want to set the variable in the constructor. Ex.
Class A
protected myVar as string
END Class
Class B
inherits A
'set the myVar Variable
myVar = "Class B"
End Class
I need Class A to have access to the myVar so I can't use shadows and
redeclare it. This seems like it should be trivial but I can't figure it
out. The reason I don't want to use a constructo in class B is because I
built the overloaded contructors in class A and do not want to override
each
one of them everytime I inherit class A.
You're going to have to do that though. You can't inherit constructor
implementations. You're going to have to have overloaded constructors
for each class dervied from A - these can call MyBase.New(whatever), if
you like. Initialize myVar in them.
--
Larry Lard
Replies to group please