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

What is difference between dictionary and hashtable?

523


What does protected internal access modifier mean?

549


What is a constructor in c#?

518


What is cosole application?

577


How many types of interface are there in c#?

477






What is an escape sequence?

516


What is base class in c#?

541


What are namespaces, and how they are used?

571


What is difference between function and method in c#?

460


Do events have return type c#?

510


Define a class and an object?

558


What is the difference between firstordefault and singleordefault?

482


what are nullable types in c#

524


User's session is explicitly killed by which method ?

508


What does addressof operator do in background ?

589