c ++最终课程? [英] c++ Final class ?

查看:81
本文介绍了c ++最终课程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道很久以前我已经看过一些关于这个问题的主题了它

正在使用虚拟基类...


简而言之,什么是实现Java最终类的最好方法

c ++


谢谢。

解决方案



" Bezalel Bareli" < BA ************ @ optonline.net>在消息中写道

新闻:9f ************************* @ posting.google.co m ... < blockquote class =post_quotes>我知道很久以前我已经看过一些关于这个主题的帖子了,它正在使用虚拟基类......简而言之,最好的是什么在c ++中实现Java final类的方法

谢谢。



http://www.research.att.com/~bs/bs_f...#no-derivation


john


谢谢John;我实际上正在考虑这条道路,但是,我试图将这个想法模板化。
你认为它是合法的模板;我b / b
尝试了练习并且编译失败但我会再次阅读我的模板

book。



" Bezalel Bareli" < BA ************ @ optonline.net>在消息中写道

新闻:9f ************************* @ posting.google.co m ... < blockquote class =post_quotes>感谢John;我实际上正在考虑这条道路,但是,我试图模仿这个想法。你认为它是合法的模板;我尝试了练习并且编译失败但我会再次阅读我的模板
预订。




我无法让它工作。我会说它不能被模板化

因为试图给衍生类授予友谊的问题,

但我可能是错的。

john


I know I have seen some threads on the subject long time ago and it
was using a virtual base class ...

in short, what is the nicest way to implement the Java final class in
c++

Thanks.

解决方案


"Bezalel Bareli" <ba************@optonline.net> wrote in message
news:9f*************************@posting.google.co m...

I know I have seen some threads on the subject long time ago and it
was using a virtual base class ...

in short, what is the nicest way to implement the Java final class in
c++

Thanks.



http://www.research.att.com/~bs/bs_f...#no-derivation

john


Thanks John; I was actually thinking on that path, however, I am
trying to templatize the idea. Do you think it is template legal; I
tried the exercise and failed compiling but I will read my template
book again.



"Bezalel Bareli" <ba************@optonline.net> wrote in message
news:9f*************************@posting.google.co m...

Thanks John; I was actually thinking on that path, however, I am
trying to templatize the idea. Do you think it is template legal; I
tried the exercise and failed compiling but I will read my template
book again.



I couldn''t get it to work either. I would say it cannot be templatized
because of the problem of trying to grant friendship to the derived class,
but I could be wrong.

john


这篇关于c ++最终课程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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