重写Object :: ToString()

重写Object :: ToString()

问题描述:




为什么我无法覆盖它?


这一行:virtual String ^ ToString()override = Object :: ToString;

产生此错误:无法覆盖基类方法

''System :: Object :: ToString''。


为什么会这样?


提前Tnaks,

Etam。

Hi,

why I can not override it?

This line: virtual String^ ToString() override = Object::ToString;
produces this error: cannot override base class method
''System::Object::ToString''.

Why is that?

Tnaks in advance,
Etam.

Etam< od ******* @ gmail.comwrote:
Etam <od*******@gmail.comwrote:

为什么我无法覆盖它?


这一行:virtual String ^ ToString()override = Object :: ToString;

产生此错误:无法覆盖基类方法

'' System :: Object :: ToString''。


为什么会这样?
why I can not override it?

This line: virtual String^ ToString() override = Object::ToString;
produces this error: cannot override base class method
''System::Object::ToString''.

Why is that?



我不熟悉C ++语法,但是如果你展示了一个完整的演示,那么可能会更容易看到什么'错了?


http://www.pobox.com/~skeet/csharp/complete.html 了解详情

我的意思是什么。


-

Jon Skeet - < sk *** @ pobox.com>
http://www.pobox.com/~skeet 博客: http://www.msmvps.com/jon.skeet

如果回复小组,请不要给我发邮件

I''m not familiar with the C++ syntax, but perhaps if you showed a
complete demonstration it would be easier to see what''s wrong?

See http://www.pobox.com/~skeet/csharp/complete.html for details of
what I mean by that.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too


有代码:

http://eugeneciurana.com/pastebin/pa....php?show=5225

There is the code:

http://eugeneciurana.com/pastebin/pa....php?show=5225


Etam< od ******* @ gmail.comwrote:
Etam <od*******@gmail.comwrote:

有代码:

http://eugeneciurana.com/pastebin/pa....php?show = 5225



嗯。看看几个在线示例,我的猜测是你不需要b $ b需要重新指定虚拟。另一方面,这不会真的与编译器消息一致...


很抱歉不能为你提供进一步的帮助:(


-

Jon Skeet - < sk *** @ pobox.com>
http://www.pobox.com/~skeet 博客: http://www.msmvps.com/jon.skeet

如果回复该群组,请执行不要给我发邮件

Hmm. Looking at a couple of online examples, my guess is that you don''t
need to respecify "virtual". On the other hand, that wouldn''t really
fit with the compiler message...

Sorry not to be able to help you further :(

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too