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 |
How many destructors can a class have?
Can an interface inherit class/abstract class.
What is the xml document structure?
What is datarelation c#?
What is lazy t?
If I have more than one version of one assemblies, then how'll I use old version (how/where to specify version number?)in my application?
What is the purpose of namespace in c#?
What Is The Difference Between ViewState and SessionState?
What is the name of the implicit input parameter of a set accessor for any property?
Name the two classes are required for implementing a windows service?
Which of these statements correctly declares a two-dimensional array in c#?
What is the Difference between read only and constant variables?
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)