Click here to Skip to main content
15,890,845 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi
I have a base class CodeElement and multiple classes which inherit CodeElement.

How can I have a function returning (anything which inherits CodeElement)?

What I have tried:

Searching for a while about inheritance
Posted
Updated 11-Jun-17 19:14pm
v2

1 solution

Declare the method as returning an instance of the base class:
Public Function MyMethod() As CodeElement
	...
End Function
It can then return any value which is derived from CodeElement
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900