带有Protected修饰符的基类 [英] Base class with Protected modifier

查看:84
本文介绍了带有Protected修饰符的基类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我正在尝试使用Protected关键字创建基类


受保护的MustInherit类MyBaseClas

..

..

结束Clas


我收到一条错误,说像Protected关键字这样的东西不能使用


任何人都有任何想法


谢谢。

解决方案

*=?Utf-8?B?Q2hyaXM =?=" <一个******* @ discussions.microsoft.com> scripsit:

我正在尝试使用Protected关键字创建一个基类:

受保护的MustInherit类MyBaseClass
...
... <结束课

我得到一个错误,说不能使用像Protected关键字这样的东西。




你想要什么?通过指定这个关键字?!


-

Herfried K. Wagner [MVP]

< URL:http:/ /dotnet.mvps.org/>


" Herfried K. Wagner [MVP]" <喜*************** @ gmx.at>在留言中写道

news:c6 ************ @ ID-208219.news.uni-berlin.de ...

什么你想通过指定这个关键字来实现它吗?!




它可能在嵌套类的上下文中有意义。我已经完成了几次




到原始海报:很可能你正在寻找朋友

关键字。 "朋友"和公共是唯一两个范围修饰符,可以

适用于顶级课程。


Jeremy


"克里斯" <一个******* @ discussions.microsoft.com> schrieb



我正在尝试用Protected关键字创建一个基类:

受保护的MustInherit类MyBaseClass
.. 。
...
结束课

我得到一个错误,说不能使用像Protected关键字那样的东西。

任何人有什么想法吗?

谢谢。




受保护意味着该类仅在外部类中可见且
$ b来自外部类的$ b类。


class outerclass

受保护的MustInherit类MyBaseClass

...

...

结束类

结束类

如果没有外部类,因为你将MyBaseClass放在命名空间中,

受保护无效且没有意义。

-

Armin


如何引用及原因:
http://www.plig.net / NNQ / nquo te.html
http://www.netmeister .org / news / learn2quote.html


Hi

I am trying to create a base class with the Protected keyword

Protected MustInherit Class MyBaseClas
..
..
End Clas

And I got an error saying something like the Protected keyword cannot be used

Anyone has any idea

Thanks.

解决方案

* "=?Utf-8?B?Q2hyaXM=?=" <an*******@discussions.microsoft.com> scripsit:

I am trying to create a base class with the Protected keyword:

Protected MustInherit Class MyBaseClass
...
...
End Class

And I got an error saying something like the Protected keyword cannot be used.



What do you want to archieve by specifying this keyword?!

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>


"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:c6************@ID-208219.news.uni-berlin.de...

What do you want to archieve by specifying this keyword?!



It could make sense in the context of nested classes. I''ve done that a
few times.

To the original poster: Most likely you are looking for the "Friend"
keyword. "Friend" and "Public" are the only two scope modifiers that can
apply to top-level classes.

Jeremy


"Chris" <an*******@discussions.microsoft.com> schrieb

Hi,

I am trying to create a base class with the Protected keyword:

Protected MustInherit Class MyBaseClass
...
...
End Class

And I got an error saying something like the Protected keyword cannot
be used.

Anyone has any idea?

Thanks.



Protected means that the class is only visible in the outer class and the
classes derived from the outer class.

class outerclass
Protected MustInherit Class MyBaseClass
...
...
End Class
end class
If there is no outer class because you put MyBaseClass in a Namespace,
protected is invalid and doesn''t make sense.
--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html


这篇关于带有Protected修饰符的基类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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