说我有两节课: A级 { 公开: int x; }; class B { public: A a; }; 然后我如何构建一个指向B :: ax的成员指针?什么是语法 呢? 谢谢!
Say I have two classes: class A { public: int x; }; class B { public: A a; }; Then how do I construct a member pointer to B::a.x ? What''s the syntax for it? Thanks!
推荐答案hu ***** @ gmail 写道: Say我有两节课: A级 { public: int x; }; B级 { 公开: A; }; 然后如何构造一个指向B :: ax的成员指针?什么是语法 呢? Say I have two classes: class A { public: int x; }; class B { public: A a; }; Then how do I construct a member pointer to B::a.x ? What''s the syntax for it?
为什么你认为你需要它?这有用吗: B b; int * ptr =& bax; V - 请在通过电子邮件回复时删除资金''A' 我不回复热门回复,请不要问
Why do you think you need it? Does this help: B b; int *ptr = &b.a.x; V -- Please remove capital ''A''s when replying by e-mail I do not respond to top-posted replies, please don''t ask
hu ***** @ gmail 写道: 说我有两节课: A级 { 公开: int x; }; B级 { public: A a; }; 那怎么办我构造了一个指向B :: ax的成员指针?什么是语法 呢? 谢谢! Say I have two classes: class A { public: int x; }; class B { public: A a; }; Then how do I construct a member pointer to B::a.x ? What''s the syntax for it? Thanks!
不确定您需要什么,但下面的代码示例可能有所帮助 int A :: * ptr = A :: x; 例子; 示例。* ptr = 15; JB
Not sure what you require, but the code sample below may be of help int A::*ptr = A::x; A Example; Example.*ptr = 15; JB
n2xssvv.g02gfr12930写道: n2xssvv.g02gfr12930 wrote: hu **** *@gmail 写道: >说我有两个班级: A班级 { 公开: int x; }; B班 {公开: A a; }; 然后如何构造一个指向B :: ax的成员指针?它的语法是什么?谢谢! >Say I have two classes:class A{public: int x;};class B{public: A a;};Then how do I construct a member pointer to B::a.x ? What''s the syntaxfor it?Thanks!
不确定您需要什么,但下面的代码示例可能有所帮助 int A :: * ptr =斧头;
Not sure what you require, but the code sample below may be of help int A::*ptr = A::x;
int A :: * ptr =& A :: x; (没有&符号''不合法的。
int A::*ptr = &A::x; (without the ampersand it''s not legal).
一个例子; 例子。* ptr = 15; A Example; Example.*ptr = 15;现在为B做这个...... :-) V - 请在通过电子邮件回复时删除资金''A' 我没有回复最热门的回复,请不要''请问
Now do that for a ''B''... :-) V -- Please remove capital ''A''s when replying by e-mail I do not respond to top-posted replies, please don''t ask
更多推荐
指向成员成员的指针
发布评论