Is it possible to get the memory-allocated address of a newly-instantiated class from within that class s constructor?
I am developing a linked list where multiple classes have multiple pointers to like classes. Each time a new class instantiates, it needs to check its parent s list to make sure it is included.
如果我试图这样做的话:
MyClass() // constructor
{
extern MyClass * pParent;
for ( int i = 0; i < max; i++ )
{
pParent->rels[i] == &MyClass; // error
}
}
我发现这一错误:
C2275:名称空间:MyClass:非法使用这种表达方式
欢迎任何想法或建议。 感谢。