How to restrict an access to some of the functions at third level in Classes (OOPs)
Posted
by Shantanu Gupta
on Stack Overflow
See other posts from Stack Overflow
or by Shantanu Gupta
Published on 2010-05-17T04:57:38Z
Indexed on
2010/05/17
5:00 UTC
Read the original article
Hit count: 268
I have created a class say A which has some functions defined as protected.
Now Class B inherits A and class C inherits B. Class A has private default constructor and protected parameterized constructor.
I want Class B to be able to access all the protected functions defined in Class A but class C can have access on some of the functions only not all the functions and class C is inheriting class B.
How can I restrict access to some of the functions of Class A from Class C ?
Class A
{
private A(){}
protected A(int ){}
}
Class B : A
{}
CLass C:B
{
}
© Stack Overflow or respective owner