C++中的“对象”概念实质是什么呢?

勇敢的搬砖人 2010-01-26 07:21:01
C++中的“对象”概念实质是什么呢?
...全文
256 14 打赏 收藏 转发到动态 举报
写回复
用AI写文章
14 条回复
切换为时间正序
请发表友善的回复…
发表回复
icansaymyabc 2010-01-26
  • 打赏
  • 举报
回复
“对象”可以理解为一个实体,而非纯概念性的东西。

febbird1984 2010-01-26
  • 打赏
  • 举报
回复
就是某种数据类型的实例

int a=5;//a是一个对象,是int的一个实例

class A
{
char c;
} a;//a也是一个对象,是class A的一个实例
zzcmx2008 2010-01-26
  • 打赏
  • 举报
回复
对象,就是现实社会的一种抽象,具体说是一件确切存在的事物的抽象出来的模型。
icerlion 2010-01-26
  • 打赏
  • 举报
回复
建议看看相关书籍
rtygbwwwerr 2010-01-26
  • 打赏
  • 举报
回复
类的实例就是对象。举个例子,有一种动物叫熊猫
对应的类定义:class CPanda{};
北京动物园的熊猫胖胖即为熊猫类的一个实例对象:
对应的定义:CPanda BJPangPang;
BJPangPang就是一个对象
icerlion 2010-01-26
  • 打赏
  • 举报
回复
扩展的struct
cismylife 2010-01-26
  • 打赏
  • 举报
回复
有人这样说过

卡拉是条狗。
狗:一张嘴,两只眼睛,四条腿,。。。。会跑,回咬,回叫

public class dog{
String name;
int mouth=1;
int eyes=2;
....
dog(String dogname){
name=dogname;
};
public run(){};
...
}

...
dog kala=new dog("卡拉");

对象就是: 把卡拉和kala,在现实世界和计算机世界联系起来
crst_zh 2010-01-26
  • 打赏
  • 举报
回复
对象---“具体的”一个“实例”
lovesi3344 2010-01-26
  • 打赏
  • 举报
回复
对象

如果是类的对象
实质就是类这种类型的变量
又称“类的实例”

如果是广义的对象
实质就是一种“东西”
自由建客 2010-01-26
  • 打赏
  • 举报
回复
数据结构对象
飞天御剑流 2010-01-26
  • 打赏
  • 举报
回复
1.8 The C+ + object model [intro.object]

1 The constructs in a C + + program create, destroy, refer to, access, and manipulate objects. An object is a region of storage. [Note: A function is not an object, regardless of whether or not it occupies storage in the way that objects do. ] An object is created by a definition (3.1), by a new-expression (5.3.4) or by the implementation (12.2) when needed. The properties of an object are determined when the object is created. An object can have a name (clause 3). An object has a storage duration (3.7) which influences its lifetime (3.8). An object has a type (3.9). The term object type refers to the type with which the object is created.
Some objects are polymorphic (10.3); the implementation generates information associated with each such object that makes it possible to determine that object’s type during program execution. For other objects, the interpretation of the values found therein is determined by the type of the expressions (clause 5) used to
access them.

2 Objects can contain other objects, called sub-objects. A sub-object can be a member sub-object (9.2), a base class sub-object (clause 10), or an array element. An object that is not a sub-object of any other object is called a complete object.
ithiker 2010-01-26
  • 打赏
  • 举报
回复
我觉得是一种广义的变量
clhposs 2010-01-26
  • 打赏
  • 举报
回复
你可以把他想象成实际占用内存空间

64,648

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

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