You are designing a class for an application. You need to restrict the availability of the
member variable accessCount to the base class and to any classes that are derived from the
base class.
Which access modifier should you use?
A.
Internal
B.
Protected
C.
Private
D.
Public
This is not the correct answer. The correct answer is B. Protected. The private access modifier limits the availability of a class member to the containing class only while protected makes it also available for the derived classes.
Please, don’t post incorrect answers!
Yes, private class only could be accessed on Base Class.
It’s not the right answer ,the right is protected.
B. which is “Protected” is the correct answer..
someone please correct this..
C is the correct answer of which its Private
No, B is the correct answer. Never will a derived class have access to a private member of its base class. Only Protected gives both (at the most restricted level).
C is the correct answer
https://msdn.microsoft.com/en-us/library/ms173121.aspx
B is correct ‘Protected’. Private is the most restricted access modifier one can assign, it will never be reached outside of the class that it is declared in.
protected
The type or member can be accessed only by code in the same class or struct, or in a class that is derived from that class.
chutiyo sahi answer submit kia karo
public
The type or member can be accessed by any other code in the same assembly or another assembly that references it. +
private
The type or member can be accessed only by code in the same class or struct.
protected
The type or member can be accessed only by code in the same class or struct, or in a class that is derived from that class.
internal
The type or member can be accessed by any code in the same assembly, but not from another assembly.