密封关键字的应用 [英] application of sealed keyword

查看:66
本文介绍了密封关键字的应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



有人知道什么时候应该上课吗?难道不是所有班级都要开放继承吗?


谢谢!


Would somebody know when we should seal a class? Shouldn''t all classes be
open up for inheritance?

Thanks!

推荐答案

Zeng写道:
有人知道我们何时应该上课?难道不是所有的课程都要开放继承吗?
Would somebody know when we should seal a class? Shouldn''t all
classes be open up for inheritance?




这就是重点:这个决定留给了设计师。 />

-

有10种人。那些懂二元的人和那些没有b $ b的人。

http://code.acadx.com

(拉针回复)



That''s the whole point: that decision is left to the designer.

--
There are 10 kinds of people. Those who understand binary and those who
don''t.

http://code.acadx.com
(Pull the pin to reply)


有一些你不想要继承的东西。我想到的主要问题是,你不必担心任何人从你的班级继承

,你可以将虚函数调用更改为非虚拟

调用。可能听起来不是什么大不了的事,但也可能。当然,那里的
并不是很多例子,但它足以让它成为值得注意的。另一个例子是你可能拥有所有静态成员

http://msdn.microsoft.com/library/de...tml/copybr.asp

"曾" < zz*@nonospam.com>在消息中写道

新闻:OO ************** @ TK2MSFTNGP12.phx.gbl ...
There are some things that you don''t want inheritable. The main thing that
comes to mind is that i fyou don''t have to worry about anyone inheriting
from your class, you can change virtual function invokes to non-virtual
invokes. May not sound like a big deal, but it can be. Granted, there
aren''t a whole lot of instances for this, but there are enough for it to be
noteworthy. Another instance is when you may have all static members

http://msdn.microsoft.com/library/de...tml/copybr.asp
"Zeng" <zz*@nonospam.com> wrote in message
news:OO**************@TK2MSFTNGP12.phx.gbl...

有人知道什么时候应该上课吗?难道不是所有的课程都要开放继承吗?

谢谢!

Would somebody know when we should seal a class? Shouldn''t all classes be
open up for inheritance?

Thanks!



谢谢为了回复,我可以看到你指出的第一个实例,但是

第二个......如果隔壁的那个人想继承我的班级,那就是全部

staic成员,然后由他决定,那里没有设计问题。


" William Ryan" <做******** @ nospam.comcast.net>在消息中写道

新闻:Oq ************** @ TK2MSFTNGP09.phx.gbl ...
Thanks for replying, I can see the first instance you pointed out, but the
second one..hm, if the guy next door wants to inherit my class which has all
staic members, then it would be up to him, there isn''t a design issue there.

"William Ryan" <do********@nospam.comcast.net> wrote in message
news:Oq**************@TK2MSFTNGP09.phx.gbl...
有些事情是你不想要遗传。我想到的主要问题是,你不必担心任何人从你的班级继承
,你可以将虚拟函数调用更改为非虚拟调用。可能听起来不是什么大不了的事,但也可能。当然,这并不是很多例子,但是足够值得注意的是
。另一个例子是你可能拥有所有静态成员

http://msdn.microsoft.com/library/de...tml/copybr.asp " Zeng" < zz*@nonospam.com>在消息中写道
新闻:OO ************** @ TK2MSFTNGP12.phx.gbl ...
There are some things that you don''t want inheritable. The main thing that comes to mind is that i fyou don''t have to worry about anyone inheriting
from your class, you can change virtual function invokes to non-virtual
invokes. May not sound like a big deal, but it can be. Granted, there
aren''t a whole lot of instances for this, but there are enough for it to be noteworthy. Another instance is when you may have all static members

http://msdn.microsoft.com/library/de...tml/copybr.asp "Zeng" <zz*@nonospam.com> wrote in message
news:OO**************@TK2MSFTNGP12.phx.gbl...

有人知道我们什么时候应该封一课?难道不是所有的课程都可以开放继承吗?

谢谢!

Would somebody know when we should seal a class? Shouldn''t all classes be open up for inheritance?

Thanks!




这篇关于密封关键字的应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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