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
How many constructors can a class have c#?
Why do we use abstraction in c#?
Do events have return type c#?
Can you create an instance of a static class?
What is boxing in c#?
What are primitive data types in c#?
How do you inherit a class into other class in c#?
What is generic delegate in c#?
What is data type in c# with example?
What are the applications of c#?
Explain the role of Garbage collector and its generations?
When To use HashTable In C#
What is the difference between do and while loop?
Tell me the difference between call by value and call by reference.
Is c sharp open source?