Can an abstract method have a varying return type?

cjard

Well-known member
Joined
Apr 25, 2006
Messages
7,081
Programming Experience
10+
Suppose I want to create a suite of objects, all whom support GetValue but I want the type of the value to vary.

I can declare the parent GetValue to return object, but I'm wondering if I can make it typed, such that no casting will be required

MyGenericObject.GetValue() 'abstract method
MyDateObject.GetValue() 'returns a date


Now, this might not matter too much because I will be calling a stored procedure, and hence the Parameters collection of the sql command can accept all values in as objects

.. it just prompted the quesition n my mind, over whether the return value can be abstract generic in the parent and refined in the subclass, and used *unboxed*without casting?
 
Both Shadows or Overloads keywords can be used to do this.
 
Back
Top