<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
<META NAME="GENERATOR" CONTENT="GtkHTML/4.2.2">
</HEAD>
<BODY>
class Known<BR>
{<BR>
void* data; // external data by c api<BR>
int type; // 0 for int, 1 for string, etc. ..<BR>
}<BR>
<BR>
How can I implement a method like this?<BR>
<BR>
Known known; // <-- suppose known.type == 1;<BR>
string s = known.value(); // <-- automatic <BR>
<BR>
I just know how to do this:<BR>
<BR>
string s = know.value!string(); <BR>
<BR>
<BR>
<BR>
<BR>
</BODY>
</HTML>