Magic type return
Andrea Fontana
nospam at example.com
Tue Jul 17 06:56:28 PDT 2012
class Known
{
void* data; // external data by c api
int type; // 0 for int, 1 for string, etc. ..
}
How can I implement a method like this?
Known known; // <-- suppose known.type == 1;
string s = known.value(); // <-- automatic
I just know how to do this:
string s = know.value!string();
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20120717/5bec76d5/attachment.html>
More information about the Digitalmars-d-learn
mailing list