When you inherit a protected class-level variable, who is it
available to?
Answers were Sorted based on User's Feedback
//When you inherit a protected class-level variable, who is
it available to?
//Answer is classes within the same namespace
namespace SameNamespace
{
class MyBaseClass
{
protected int myprotectedint;
}
class MyDerivedClass:MyBaseClass
{
public int GetProtectedMember()
{
return myprotectedint;
}
public MyDerivedClass(int myvalue)
{
myprotectedint = myvalue;
}
}
class MyTest
{
public static void Main()
{
MyDerivedClass mdc = new MyDerivedClass(12);
Console.WriteLine(mdc.GetProtectedMember());
Console.ReadKey();
}
}
}
Is This Answer Correct ? | 0 Yes | 0 No |
Is namespace a class?
What is the purpose of a console table?
Define thread?
Why do we use overloading in c#?
Why do we use dataset in c#?
Can bool be null c#?
How will you deploy the dll file in gac?
Can you access a hidden base class method in the derived class?
What is the use of system.environment class in c#.net?
Define assert() method? How does it work?
What is CLR and its application.?
What is the difference between list and array in c#?