|
-
November 27th, 2002, 02:47 PM
#1
Find out what class an object belongs to after casting
What can I do in order to get this running without using wrapper classes?
class MyClass
{
public:
int x;
int y;
};
void print(void* x)
{
// Here I need to
// know what type x is of
// (int or double or Myclass, or anything...)
}
void main(void)
{
int* x1 = new int(3);
MyClass* x2 = new MyClass();
x2->x = 5;
x2->y = 5;
print(x1);
print(x2);
delete x1;
delete x2;
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|