overriding a variable??

G

Guest

Hello,
I have a Parent form call say MyProjectForm which is inherited, in
this I have a variable call MyProjectItemNode of type treenode.
I also have an overridable function called SelectNode in both the base and
inherited form. However my problem is that the variable MyProjectItemNode can
be of various different types all of which I inherit from the treenode,
therefore I wish to Override the variable in the original form and Use the
one in each inherited form and set it to the correct type in each form. I
don't want to use a type of Object in the base because this is bad coding.
Is this possible?

Regards
Geri
 
H

Herfried K. Wagner [MVP]

ghobley said:
I have a Parent form call say MyProjectForm which is inherited, in
this I have a variable call MyProjectItemNode of type treenode.
I also have an overridable function called SelectNode in both the base and
inherited form. However my problem is that the variable MyProjectItemNode
can
be of various different types all of which I inherit from the treenode,
therefore I wish to Override the variable in the original form and Use
the
one in each inherited form and set it to the correct type in each form. I
don't want to use a type of Object in the base because this is bad coding.

Mark the variable as private and re-introduce a variable with the same name
but with a different type in the derived class.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top