指向 C++/CLI 中数据成员的指针
如何在 C++/CLI 中创建指向数据成员的指针 例如
ref class team
{
List<teamMember^> members;
teamMember^ leader; //the aim is to make it a pointer to an element in the list
void changeLeader(teamMember^% member) //member is an element from members
{
leader=member; //doesn't reference and %member gave an error
}
};
How can I make a pointer to a data member in C++/CLI
for example
ref class team
{
List<teamMember^> members;
teamMember^ leader; //the aim is to make it a pointer to an element in the list
void changeLeader(teamMember^% member) //member is an element from members
{
leader=member; //doesn't reference and %member gave an error
}
};
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在 C++/Cli 中,句柄 (^) 类似于本机指针。
这段代码会起作用。
看看这个和此 了解更多信息。
In C++/Cli handles (^) are analoguos to native pointers.
This code will work.
Take a look at this and this for more info.