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 comparable and comparator?
What is difference between singleton and static class in c#?
In how many ways you can overload a method?
What is the difference between a class and an object c#?
What is multicast delegate explain with example?
Where do we use static class in c#?
What is difference between dynamic and var in c#?
How to find methods of a assembly file (not using ILDASM)?
What is the difference between ref & out parameters in c#?
What is the difference between “finalize” and “finally” methods in c#?
How do I format a string in c#?
What is difference between float and integer?
What is the difference between first and firstordefault?
How do you encapsulate in c#?
What is application c#?