📄 subject_50721.htm
字号:
<p>
序号:50721 发表者:Fe 发表日期:2003-08-26 08:44:48
<br>主题:菜鸟提问:-> 符号是什么意思啊
<br>内容:比如 pStatic3->SetWindowText("")<BR>刚刚开始学vc,c++也只大概看了一遍。<BR>请指导
<br><a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p>
<hr size=1>
<blockquote><p>
回复者:michael 回复日期:2003-08-26 08:50:57
<br>内容:Structure, Union, and Class Member Operators: . and -><BR>postfix-expression<BR><BR>. identifier <BR><BR>postfix-expression<BR><BR>–> identifier<BR><BR>A “member-selection expression” refers to members of structures, unions, and classes. Such an expression has the value and type of the selected member. <BR><BR>This list describes the two forms of the member-selection expressions: <BR><BR>In the first form, postfix-expression represents a value of struct, class, or union type, and identifier names a member of the specified structure, union, or class. The value of the operation is that of identifier and is an l-value if postfix-expression is an l-value.<BR><BR><BR>In the second form, postfix-expression represents a pointer to a structure, union,or class, and identifier names a member of the specified structure, union, or class. The value is that of identifier and is an l-value. <BR>The two forms of member-selection expressions have similar effects. <BR><BR>In fact, an expression involving the member-selection operator (->) is a shorthand version of an expression using the period (.) if the expression before the period consists of the indirection operator (*) applied to a pointer value. Therefore, <BR><BR>expression -> identifier<BR><BR>is equivalent to<BR><BR>(*expression) . identifier<BR><BR>when expression is a pointer value.<BR><BR>Example<BR><BR>In the following example, the structure Dates and one object, myDates, is declared. The members of the myDates object are initialized with values for the beginning of 1995.<BR><BR>// Example of the structure operator<BR>struct Dates {<BR> CString sGregorian;<BR> int nJulian;<BR>};<BR>Dates myDates;<BR>Dates.nJulian = 1;<BR>Dates.sGregorian = "01/01/95";<BR><BR>摘自《MSDN》<BR>
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:iamhere 回复日期:2003-08-26 09:28:05
<br>内容:->是用作结构(struct)、联合(union)或者类(class)指针对其成员的引用,<BR>如果非指针,则是使用.
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
<font color=red>答案被接受</font><br>回复者:张庆芳 回复日期:2003-08-26 09:28:26
<br>内容:我说简单些:<BR>->前面的应该是指向对象的指针,->后面的应该是该对象的属性,或者是该对象的方法。<BR>
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:Fe 回复日期:2003-08-26 09:47:08
<br>内容:谢谢
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -