<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[How to call a function by a string of name &amp;amp; How to get the name of a class?]]></title><description><![CDATA[<p>There are hundred of similar classes and a large file(in processing)<br />
with thousand of instances of these classes. I should export these<br />
instances into a XML file (I use Tiny XML), however not total<br />
instances, but these which belong to the selected classes and the<br />
selected attributes(member variable and value). In advance, I will<br />
have a configuration file (also XML format), to define which classes<br />
and which attributes are selected, that is a user-defined file.<br />
The problem are:</p>
<p>1, How do I get the name of a class? Just like by Java the<br />
method .getclass() or instanceof ?</p>
<p>2, Is it possible to have such as an iterator to traverse through<br />
all the variables/functions, to only call the functions and to get<br />
the values of variables I need by name?</p>
<p>Vielen Dank im Voraus!</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/217170/how-to-call-a-function-by-a-string-of-name-amp-how-to-get-the-name-of-a-class</link><generator>RSS for Node</generator><lastBuildDate>Sat, 10 Oct 2026 23:02:54 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/217170.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 03 Jul 2008 23:31:37 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to How to call a function by a string of name &amp;amp; How to get the name of a class? on Thu, 03 Jul 2008 23:31:37 GMT]]></title><description><![CDATA[<p>There are hundred of similar classes and a large file(in processing)<br />
with thousand of instances of these classes. I should export these<br />
instances into a XML file (I use Tiny XML), however not total<br />
instances, but these which belong to the selected classes and the<br />
selected attributes(member variable and value). In advance, I will<br />
have a configuration file (also XML format), to define which classes<br />
and which attributes are selected, that is a user-defined file.<br />
The problem are:</p>
<p>1, How do I get the name of a class? Just like by Java the<br />
method .getclass() or instanceof ?</p>
<p>2, Is it possible to have such as an iterator to traverse through<br />
all the variables/functions, to only call the functions and to get<br />
the values of variables I need by name?</p>
<p>Vielen Dank im Voraus!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1540719</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1540719</guid><dc:creator><![CDATA[cutecutemouse]]></dc:creator><pubDate>Thu, 03 Jul 2008 23:31:37 GMT</pubDate></item><item><title><![CDATA[Reply to How to call a function by a string of name &amp;amp; How to get the name of a class? on Fri, 04 Jul 2008 00:47:48 GMT]]></title><description><![CDATA[<p>For instance using &quot;typeid&quot; you can do this:</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;conio.h&gt;
#include &lt;string&gt;
using namespace std;

struct X
{
    public:
        int a;
};

class Y
{
};

int main()
{
    int    a;
    float  b;
    double c;
    string d;
    X      e;
    Y      f;

    cout &lt;&lt;  typeid(a).name() &lt;&lt; endl;
    cout &lt;&lt;  typeid(b).name() &lt;&lt; endl;
    cout &lt;&lt;  typeid(c).name() &lt;&lt; endl;
    cout &lt;&lt;  typeid(d).name() &lt;&lt; endl;
    cout &lt;&lt;  typeid(e).name() &lt;&lt; endl;
    cout &lt;&lt;  typeid(f).name() &lt;&lt; endl;
    cout &lt;&lt;  typeid(e.a).name() &lt;&lt; endl;
    getch();
}
</code></pre>
<pre><code>i
f
d
Ss
1X
1Y
i
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1540727</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1540727</guid><dc:creator><![CDATA[Erhard Henkes]]></dc:creator><pubDate>Fri, 04 Jul 2008 00:47:48 GMT</pubDate></item></channel></rss>