修饰符与界面有什么关系? [英] What does the modifier have methid from interface?

查看:94
本文介绍了修饰符与界面有什么关系?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有下一个界面:

界面我

{

void F();

}


下一课实现了这个界面:

class MyClass:I

{

void F( ){};

}


修饰符有什么方法MyClass :: F()by

默认?

解决方案

默认情况下F有私有修饰符


然而,编译器不会让你编译代码,因为为了实现界面,你必须将该方法声明为公共


" Vladimir Bezugliy" < VB ** @ inbox.ru>在留言中写道

news:e8 **************************** @ phx.gbl ... < blockquote class =post_quotes>我有下一个界面:
接口我
{
void F();
}

下一个类实现这个界面:
类MyClass:我
{
void F(){};
}

修饰符有什么方法MyClass :: F ()
默认?



我在另一组中回答了你的问题。请不要多重打击。

-

____________________

Klaus H. Probst,MVP
http://www.vbbox.com/


" Vladimir Bezugliy" < VB ** @ inbox.ru>在留言中写道

news:e8 **************************** @ phx.gbl ... < blockquote class =post_quotes>我有下一个界面:
接口我
{
void F();
}

下一个类实现这个界面:
类MyClass:我
{
void F(){};
}

修饰符有什么方法MyClass :: F ()
默认?



>默认情况下F有私有修饰符


你这样做不明白我的权利。

默认情况下来自ionterface的Metod是公开的。

但它是什么共同的 - 公共虚拟或公开

虚拟密封?


I have next interface:
interface I
{
void F();
}

And next class implements this interface:
class MyClass : I
{
void F(){};
}

What does the modifier have the method MyClass::F() by
default?

解决方案

By default F has private modifier

However, compiler won''t let you compile the code, because in order to
implement the interface you have to declare that method as public

"Vladimir Bezugliy" <vb**@inbox.ru> wrote in message
news:e8****************************@phx.gbl...

I have next interface:
interface I
{
void F();
}

And next class implements this interface:
class MyClass : I
{
void F(){};
}

What does the modifier have the method MyClass::F() by
default?



I answered your question in another group. Please don''t multipost.
--
____________________
Klaus H. Probst, MVP
http://www.vbbox.com/

"Vladimir Bezugliy" <vb**@inbox.ru> wrote in message
news:e8****************************@phx.gbl...

I have next interface:
interface I
{
void F();
}

And next class implements this interface:
class MyClass : I
{
void F(){};
}

What does the modifier have the method MyClass::F() by
default?



>By default F has private modifier

You do not understand me right.
Metod from ionterface is public by default.
But what bublic is it - "public virtual" or "public
virtual sealed"?


这篇关于修饰符与界面有什么关系?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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