What is the difference between protected and protected internal?
Answers were Sorted based on User's Feedback
Answer / lakshmi harathi
Protected: This also allows a class to hide its member
var. and member func. from other class objects and
function, except the child class. it becomes important
while implementing inheritance.
"it can be accessible into derived class with in the same
application "
"protected members can be accessed within the class and the
derived class"
Protected Internal: it's similar to Protected access
specifier, it also allows a class to hide its member
variables and member function to be accessed from other
class objects and function, excepts child class, within the
application. used while implementing inheritance.
| Is This Answer Correct ? | 9 Yes | 5 No |
Answer / anusha
Internal:
When Members of a class are declared as internal, then they can be accessed
1. within the class in which they are declared.
2. within the derived classes of that class available within the same assembly.
3. outside the class within the same assembly.
Protected:
When Members of a class are declared as protected, then they can be accessed
1. within the class in which they are declared.
2. within the derived classes of that class available within the same assembly.
3. within the derived classes of that class available outside the assembly.
Protected internal:
When Members of a class are declared as protected internal, then they can be accessed
1. within the class in which they are declared.
2. within the derived classes of that class available within the same assembly.
3. outside the class within the same assembly.
4. within the derived classes of that class available outside the assembly.
| Is This Answer Correct ? | 3 Yes | 1 No |
Answer / manu
protected is really protected inside and outside the assembly (protected internal / protected external) (not allowed on top level classes)
protected internal is really public inside the assembly but protected outside the assembly (public internal / protected external) (not allowed on top level classes)
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / mahi
Protected Internal: it's similar to Protected access
specifier, it also allows a class to hide its member
variables and member function to be accessed from other
class objects and function, excepts child class, within the
application. used while implementing inheritance.
| Is This Answer Correct ? | 1 Yes | 2 No |
Answer / sujai cn
protected :
The members which are declared as protected can only be
accesed from the derived class.
Internal :
In c# The members which are declared as Internal can only
be accessed "with in the assembly(dll or an exe)".
Thus when we declare a member as protedcted internal it can
be accessed by the derived class with in the same asssembly.
| Is This Answer Correct ? | 2 Yes | 5 No |
What is an assembly in dotnet?
What is the Difference between class and abstract class?
What are the properties of a string class?
How can I produce an assembly?
What namespace is list in c#?
How can we main a Class as base class,i.e not inherited further?{please Dont tell using Sealed class,any other way}
6 Answers ACB Group, IBM, Tech Mahindra,
Which technology is best for desktop application?
If I want to override a method one of class A and in class b then how do you declare?
what is master pages how to use it. plase give one example in code vice
Explain the top reason to use c# language?
Can delegates be used as callbacks?
public void A() { int x; x = 8; x *= 4 + 8 / 2; } Given the above code, what is the value of "x"?
Visual Basic (800)
C Sharp (3816)
ASP.NET (3180)
VB.NET (461)
COM+ (79)
ADO.NET (717)
IIS (369)
MTS (11)
Crystal Reports (81)
BizTalk (89)
Dot Net (2435)
Exchange Server (362)
SharePoint (720)
WCF (340)
MS Office Microsoft (6963)
LINQ Language-Integrated Query (317)
WPF (371)
TypeScript (144)
Microsoft Related AllOther (311)