Can we inherit a private class in chsarp? how? explain(with
code) ?
Answer Posted / manish
PRIVATE CLASS CAN BE INHERITTED ... REMEMBER INNER CLASS
CONCEPTS ,,,
PLEASE SEE THE CODE BELOW
public class OuterKing
{
public int i;
/// <summary>
/// PRIVATE BASE CLASS
/// </summary>
private class InnerJack
{
public InnerJack()
{
MessageBox.Show ("Private
class InnerJack Base Constructor");
}
public static int j =5;
public static void display()
{
MessageBox.Show (j.ToString
());
}
}
/// <summary>
/// CHILD CLASS
/// </summary>
private class InnerJackSon : InnerJack
{
public InnerJackSon()
{
MessageBox.Show ("Private
class InnerJackSon Child Constructor");
}
}
public void DisplayPrivate()
{
InnerJack.display ();
InnerJackSon IJS = new InnerJackSon
();
}
}
Is This Answer Correct ? | 8 Yes | 5 No |
Post New Answer View All Answers
What is difference between dictionary and hashtable?
What does protected internal access modifier mean?
What is a constructor in c#?
What is cosole application?
How many types of interface are there in c#?
What is an escape sequence?
What is base class in c#?
What are namespaces, and how they are used?
What is difference between function and method in c#?
Do events have return type c#?
Define a class and an object?
What is the difference between firstordefault and singleordefault?
what are nullable types in c#
User's session is explicitly killed by which method ?
What does addressof operator do in background ?