//: C09:RTTIandNesting.cpp
//{L} ../TestSuite/Test
#include <iostream>
#include <typeinfo>
using namespace std;
class One {
class Nested {};
Nested* n;
public:
One() : n(new Nested) {}
~One() { delete n; }
Nested* nested() { return n; }
};
int main() {
One o;
cout << typeid(*o.nested()).name() << endl;
} ///:~
When the above code (from Thinking in C++, Vol-2) is
compiled and linked as:
gxx -o n.exe RTTIandNesting.cpp
the output produced by n.exe is:
Q23One6Nested
I have used DJGPP version 2.03 on an NT Workstation 4.0.
The result is same in RedHat Linux 7.0 when I used egcs
and gcc, both are of versions 2.96 running on a PII-300
Sesh