|
-
July 2nd, 2009, 10:54 PM
#4
Re: Different return type depending on data
One solution (which I'm using a variation on myself at the moment) is to define a common base class Base such that Derived<string> and Derived<float> both inherit from it. Then you can specify the return type as a Base*, but actually return a pointer to whichever type you actually have.
Of course, as with all things polymorphic, you have dynamic memory forced on you a bit more than you'd probably like.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|