抽象/密封方法 [英] Abstract/Sealed method

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

问题描述




是否可以同时密封和抽象方法? MSDN

明确指出这不允许上课但是它没有提到

它的方法。我尝试了一个简单的例子,编译器不会允许我编译,但是在最近的一次采访中,我被问到这个问题和面试官声称这是用于某些

的情况!我很困惑!


谢谢,

TJM

Hi,

Is it possible to have a method sealed and abstract at the same time? MSDN
states clearly that this is not allowed for classes but it does not mention
it for methods. I tried with a simple example and the compiler would not
allow me to compile, however in a recent interview, I was asked this
question and the interviewer claimed that this is used in certain
situations! I am baffled!

Thanks,
TJM

推荐答案

.. ..如何密封方法(你不能再进一步覆盖它)和

摘要(你必须覆盖它)?这是一个矛盾。


如果面试官没有提及,你误解了,那么

密封覆盖的组合(这是唯一的申请方式)密封

方法)然后他是一般的经理。


Tasos

.... how can a method be sealed (you cannot override it any further) and
abstract (you must override it) ? It''s a contradiction.

If the interviewer was not mentioning ,and you misunderstood , the
combination of sealed override (which is the only way to apply sealed
in a method) then he was one of the usual managers.

Tasos

Tasos,


我确信我并没有误解,因为我给出了与你相同的论点

。但他坚持认为这是可能的!


TJM


" Tasos Vogiatzoglou" <电视***** @ gmail.com>在消息中写道

news:11 ********************* @ i40g2000cwc.googlegro ups.com ...
Tasos,

I am sure I did not misunderstand because I gave the same argument as you
did. But he insisted that this is possible!

TJM

"Tasos Vogiatzoglou" <tv*****@gmail.com> wrote in message
news:11*********************@i40g2000cwc.googlegro ups.com...
...如何密封方法(你不能再进一步覆盖它)和
摘要(你必须覆盖它)?这是一个矛盾。

如果面试官没有提及,你误解了,密封覆盖的组合(这是在方法中应用密封的唯一方法) )那么他就是常见的经理之一。

Tasos
... how can a method be sealed (you cannot override it any further) and
abstract (you must override it) ? It''s a contradiction.

If the interviewer was not mentioning ,and you misunderstood , the
combination of sealed override (which is the only way to apply sealed
in a method) then he was one of the usual managers.

Tasos



如果他们不给你一个,那就高兴吧位置。 :)这家伙是典型公司的典型经理。


Tasos

Be happy then if they don''t offer you a position. :) The guy was the
typical manager in the typical company :)

Tasos

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

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