C ++对象模型:好吗?坏?丑陋? [英] The C++ Object Model: Good? Bad? Ugly?

查看:60
本文介绍了C ++对象模型:好吗?坏?丑陋?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我喜欢C ++对象模型:

类的数据部分

是对象(取消引用对象可以获得POD的数据

对象)。


我不喜欢C ++对象模型:大多数OO功能

不是

可用于类对象设计而不会丢失POD。


因此,我不仅仅倾向于坏。由于局限性和

,语言并没有区分什么是非常重要的。

你对对象模型有什么看法?

What I like about the C++ object model: that the data portion of the
class
IS the object (dereferencing an object gets you the data of a POD
object).

What I don''t like about the C++ object model: that most OO features
are not
available for class object design without loss of POD-ness.

So, I''m more than leaning toward "bad" because of the limitations and
that the language doesn''t distinguish what is of very key importance.
How do you feel about the object model?

推荐答案

11月1日,6:02 * am,tonytech08< tonytec ... @ gmail.comwrote:
On Nov 1, 6:02*am, tonytech08 <tonytec...@gmail.comwrote:

我喜欢C ++对象模型:

类的数据部分

是对象(取消引用对象会获得POD的数据)

对象)。


我不喜欢C ++对象模型:大多数OO功能

不是

可用于课堂对象设计而不会丢失POD-nss。


所以,我不仅仅倾向于坏。由于局限性和

,语言并没有区分什么是非常重要的。

您对对象模型有何看法?
What I like about the C++ object model: that the data portion of the
class
IS the object (dereferencing an object gets you the data of a POD
object).

What I don''t like about the C++ object model: that most OO features
are not
available for class object design without loss of POD-ness.

So, I''m more than leaning toward "bad" because of the limitations and
that the language doesn''t distinguish what is of very key importance.
How do you feel about the object model?





我真的不完全,你的意思,但对我来说,

关于C ++对象模型的重要事项是简单性,效率和

可扩展性。例如,具体类的表示如

内存中的日期与POD Date结构完全相同。对象的大小

派生类是基类子对象及其数据的大小

成员。具有虚函数的类的对象的大小

仅增加虚拟v-ptr的大小。对于具有静态成员,多继承,
虚拟基类和RTTI的类,上面的布局是扩展的。

总之,你可以看到这三个项目。


我希望它可以帮到你。


问候,

Saeed Amrollahi

Hi
I really don''t get completely, what you mean, but for me, the
important things about C++ object model are simplicity, efficiency and
extenability. For example the representation of concrete classes like
Date in memory is exactly like a POD Date struct. The size of object
of a derived class is the size of base class sub-object and its data
members. The size of an object of a class with virtual functions
increases just by the size of virtual v-ptr. The above layout is
extended for classes with static members, multiple inheritance,
virtual base classes and RTTI.
In all, you can see these three items.

I hope it helps you.

Regards,
Saeed Amrollahi


11月1日,4:02 * am,tonytech08< tonytec ... @ gmail.comwrote:
On Nov 1, 4:02*am, tonytech08 <tonytec...@gmail.comwrote:

什么我喜欢C ++对象模型:类的数据部分是
对象(取消引用一个对象会让你获得一个POD对象的数据)。
What I like about the C++ object model: that the data portion
of the class IS the object (dereferencing an object gets you
the data of a POD object).



不,它没有。

No it doesn''t.


我不喜欢C ++对象model:大多数OO

功能都没有用于类对象设计而没有

丢失POD-ness。
What I don''t like about the C++ object model: that most OO
features are not available for class object design without
loss of POD-ness.


所以,我不仅仅倾向于坏。因为

的限制而且语言并没有区分什么是非常关键的重要因素。你对这个对象感觉如何?
型号?
So, I''m more than leaning toward "bad" because of the
limitations and that the language doesn''t distinguish what is
of very key importance. How do you feel about the object
model?



对象模型在C ++标准中是非常低级的。

故意。它是专为您构建的。您编写的类的对象

模型供您设计。它可以比许多其他语言(例如Java或C#)更多OO,当它'

合适时。就像它可以完全放弃OO模型那样'/ b $ b'是合适的(例如值对象)。

C ++的要点是它不会强加任何应用程序级别的对象

模型;它可以让你使用任何合适的东西。


-

James Kanze(GABI软件)电子邮件:ja ********* @gmail .COM

CONSEILS EN INFORMATIQUEorientéeOBJET /
$ b在objektorientierter DATENVERARBEITUNG

9处Sémard,78210圣圣西尔 - l''école$ b BERATUNG ,法国,+ 33(0)1 30 23 00 34

The "object model" in the C++ standard is very low-level.
Intentionally. It is designed for you to build on. The object
model of the classes you write is for you to design. It can be
more OO than many other languages (e.g. Java or C#), when that''s
appropriate. Just as it can drop the OO model completely when
that''s appropriate (e.g value objects). The essential point of
C++ is that it doesn''t impose any application level object
model; it lets you use whatever is appropriate.

--
James Kanze (GABI Software) email:ja*********@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l''école, France, +33 (0)1 30 23 00 34


11月1日,4:02 * am,tonytech08< tonytec ... @ gmail.comwrote:
On Nov 1, 4:02*am, tonytech08 <tonytec...@gmail.comwrote:

我喜欢C ++对象模型:数据部分

类是对象(取消引用对象会让你

POD对象的数据)。
What I like about the C++ object model: that the data portion
of the class IS the object (dereferencing an object gets you
the data of a POD object).



不,它没有。

No it doesn''t.


我不喜欢C ++对象model:大多数OO

功能都没有用于类对象设计而没有

丢失POD-ness。
What I don''t like about the C++ object model: that most OO
features are not available for class object design without
loss of POD-ness.


所以,我不仅仅倾向于坏。因为

的限制而且语言并没有区分什么是非常关键的重要因素。你对这个对象感觉如何?
型号?
So, I''m more than leaning toward "bad" because of the
limitations and that the language doesn''t distinguish what is
of very key importance. How do you feel about the object
model?



对象模型在C ++标准中是非常低级的。

故意。它是专为您构建的。您编写的类的对象

模型供您设计。它可以比许多其他语言(例如Java或C#)更多OO,当它'

合适时。就像它可以完全放弃OO模型那样'/ b $ b'是合适的(例如值对象)。

C ++的要点是它不会强加任何应用程序级别的对象

模型;它可以让你使用任何合适的东西。


-

James Kanze(GABI软件)电子邮件:ja ********* @gmail .COM

CONSEILS EN INFORMATIQUEorientéeOBJET /
$ b在objektorientierter DATENVERARBEITUNG

9处Sémard,78210圣圣西尔 - l''école$ b BERATUNG ,法国,+ 33(0)1 30 23 00 34

The "object model" in the C++ standard is very low-level.
Intentionally. It is designed for you to build on. The object
model of the classes you write is for you to design. It can be
more OO than many other languages (e.g. Java or C#), when that''s
appropriate. Just as it can drop the OO model completely when
that''s appropriate (e.g value objects). The essential point of
C++ is that it doesn''t impose any application level object
model; it lets you use whatever is appropriate.

--
James Kanze (GABI Software) email:ja*********@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l''école, France, +33 (0)1 30 23 00 34


这篇关于C ++对象模型:好吗?坏?丑陋?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆