cm****@hotmail.com wrote:
Hi
How can i do something like Java:
if (str.getClass()==String.class){
}
i found that, this syntax has error in g++:
if (typeof(a) == typeof(b)){
}
class A { public: virtual ~A() { } };
class B : public A { };
int main()
{
A a, b;
assert( typeid( a ) == typeid( b ) );
B c;
assert( typeid( a ) != typeid( c ) );
}
Frankly though, if you need to do the above, then you probably have a design problem.
--
To send me email, put "sheltie" in the subject.