会者不难,VC中有'this'这个指针吗?(50分)

B

bjmole

Unregistered / Unconfirmed
GUEST, unregistred user!
下面这段程序是BC++的用法,不知在VC中有'this'这样的指针吗?如没有,在VC有对应的东西吗?
//template <class T>
class DNode
{
private:
// circular links to the left and right
DNode *left;
DNode *right;
public:
// data is public
TEcgRec data;
// constructors
DNode(void);
DNode (const TEcgRec&amp;
item);


// list modification methods
void InsertRight(DNode *p);
void InsertLeft(DNode *p);
DNode *DeleteNode(void);


// obtain address of the next node to the left or right
DNode *NextNodeRight(void) const;
DNode *NextNodeLeft(void) const;
};
// constructor that creates an empty list and
// leaves the data uninitialized. use for header
//template <class T>
DNode::DNode(void)
{
// initialize the node so it points to itself
left = right = [blue]this[/blue];
}
 
更正:
DNode::DNode(void)
{
// initialize the node so it points to itself
left = right = this;
}
 
同样是c++语言,当然有!也相当于Delphi的self
 
当然有了
 
多人接受答案了。
 
顶部