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 c sharp language?
What are the advantages of properties in c#?
Explain how can you clean up objects holding resources from within the code?
Explain hash table in c# ?
Can a class have multiple constructors c#?
What are generic types?
What are types in c#?
Is equal in c#?
What is the difference between integer and double?
What is parallel foreach in c#?
What is difference between an reference type and value type in C#?
In object oriented programming, how would you describe encapsulation in c#?
Explain the advantage of using system.text.stringbuilder over system.string?
What is the use of GC.KeepAlive Method?
Define c# i/o classes?