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 are Indexers in C#?
0 Answers SwanSoft Technologies,
What are the steps to create a webservice and consume it?
What is file extension of webservices?
2. What happened when BO object has been called?
Write a program in c# to find the angle between the hours and minutes in a clock?
Define mutex in C#?
Name the control which cannot be placed in mdi?
What is the difference between int.Parse() and Convert.toInt32().
Define assert() method? How does it work?
Why do we Need of static class in c#?
What is the use of static in c#?
What is static void main in c#?