高手你能告诉我吗?

bluecrest 2001-07-29 02:53:26
1.why?
int & Add(int & x)
{
// 下面一行错误,故屏蔽掉
// return (x++); // 错误:返回值不可以是一个临时值

x++;
return (x);
}


2刚开始学习,不知道下面东东是什么?
__published:

...全文
109 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
flame3 2001-07-30
  • 打赏
  • 举报
回复
如果在构件板上有这个类,这个__publish关键词指定了显示在对象查看器中显示的部分的属性。只有源于TObject的类有__publish部分。
译的不好,下面的自己看吧,在帮助里有。
flame3 2001-07-30
  • 打赏
  • 举报
回复
__published

The __published keyword specifies that properties in that section are displayed in the Object Inspector, if the class is on the Component palette. Only classes derived from TObject can have __published sections.
The visibility rules for published members are identical to those of public members. The only difference between published and public members is that Object Pascal-style runtime type information (RTTI) is generated for data members and properties declared in a __published section. RTTI enables an application to dynamically query the data members, member functions, and properties of an otherwise unknown class type.

Note: No constructors or destructors are allowed in a __published section. Properties, Pascal intrinsic or VCL derived data-members, member functions, and closures are allowed in a __published section. Fields defined in a __published section must be of a class type. Properties defined in a __published section cannot be array properties. The type of a property defined in a __published section must be an ordinal type, a real type, a string type, a small set type, a class type, or a method pointer type.
ExitWindows 2001-07-30
  • 打赏
  • 举报
回复
up
whitelion 2001-07-29
  • 打赏
  • 举报
回复
c
azurecrystal 2001-07-29
  • 打赏
  • 举报
回复
1,把x++变成++x试试
azurecrystal 2001-07-29
  • 打赏
  • 举报
回复
2,表示在其中声明的方法和属性可在对象监视器中看到,并修改属性
xrbeck 2001-07-29
  • 打赏
  • 举报
回复
1.函数返回的是个引用类型。代表的是另外一个变量。出栈后释放。所以不能安全返回
2。是BCB封装的关键字。代表控件的属性。

13,825

社区成员

发帖
与我相关
我的任务
社区描述
C++ Builder相关内容讨论区
社区管理员
  • 基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧