What are the access specifiers avaible in c++?

Answer Posted / kanan

public,
private ,
protected ,
internal and
protected internal

public :
public is the most common access specifier in C# . It can be
access from anywhere, that means there is no restriction on
accessibility. The scope of the accessibility is inside
class as well as outside. The type or member can be accessed
by any other code in the same assembly or another assembly
that references it.

private :
The scope of the accessibility is limited only inside the
classes or struct in which they are declared. The private
members cannot be accessed outside the class and it is the
least permissive access level.

protected :
The scope of accessibility is limited within the class or
struct and the class derived (Inherited )from this class.
internal :
The internal access modifiers can access within the program
that contain its declarations and also access within the
same assembly level but not from another assembly.

protected internal :
Protected internal is the same access levels of both
protected and internal. It can access anywhere in the same
assembly and in the same class also the classes inherited
from the same class .

Is This Answer Correct ?    7 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Who invented oop?

649


What is constructor in oop?

585


What is encapsulation with real life example?

566


Is abstract thinking intelligence?

592


What is abstraction encapsulation?

653






How is class defined?

582


What is polymorphism in oop example?

513


What is the diamond problem in inheritance?

574


Is data hiding and abstraction same?

567


What are oops methods?

564


If a=5, b=6, c=7, b+=a%c*2. What is the final value of b?

941


What is byval and byref? What are differences between them?

1687


What does I oop mean?

613


Why can't we have instance(stack) of a class as a member of the same class like eg.Class A{A obj;} as we can have self refential pointer

1618


Why do while loop is used?

570