私人班级成员是否继承? [英] Are private class members inherited ?

查看:84
本文介绍了私人班级成员是否继承?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


我知道私有成员的范围在一个类中,但是当我们继承一个既有公共成员又有私有成员的类时,请执行
私有成员也会被继承...我问这个问题是因为我在一个网站上读到私有成员是继承的,但它们不可访问..是不是真的?




问候
Chaithanya M

Hi Everyone,


I know that the scope of the private member is with in a class,but when we inherit a class which has both public and private members ,Do the
private members also get inherited...I am asking this since i have read in a website that private members are inherited but they are not accessible..Is it ture?




Regards
Chaithanya M

推荐答案

是否也继承私有成员
是的,它们是继承的,但是它们是不可访问的.

如果需要,请在此处提供完整的详细信息: MSDN:继承(C#编程指南):对基类成员的派生类访问 [ ^ ]
Do the private members also get inherited
Yes they are inherited, but they are not accesible.

If needed, full details are here: MSDN: Inheritance (C# Programming Guide): Derived Class Access to Base Class Members[^]


这篇关于私人班级成员是否继承?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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