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 |
What is raise event and what is its use?
Can you store multiple data types in System.Array?
What is difference between managed and unmanaged code?
0 Answers SwanSoft Technologies,
all information
What operators can be used to cast from one reference type to another without the risk of throwing an exception?
What does async mean in c#?
What's difference between constants and static readonly?
What is the difference between Object and class adapters?
Is c# or c++ better for games?
Why do we use void in c#?
Which is faster abstract class or interface in c#?
What are the features of c#?