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


Please Help Members By Posting Answers For Below Questions

Define constructors

550


What is xml comments in c#?

489


What is a generic in c#?

499


Can namespace contain the private class?

488


What are the types of attributes in c#?

484






What is int32?

485


What is difference between asp net and c# net?

479


What is the difference between a field and a property in c#?

490


What is dictionary and hashtable in c#?

466


What is a destructor in c#?

521


What is default access specifier for class in c#?

473


How to assign Null value to Var?

540


What is the property of class?

573


What is scope c#?

442


What is expression tree with example?

487