Can we inherit a private class in chsarp? how? explain(with
code) ?

Answers were Sorted based on User's Feedback



Can we inherit a private class in chsarp? how? explain(with code) ? ..

Answer / tiger skumar

Private class cannot inherit be inherited in the derived class.

Is This Answer Correct ?    17 Yes 1 No

Can we inherit a private class in chsarp? how? explain(with code) ? ..

Answer / 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

Can we inherit a private class in chsarp? how? explain(with code) ? ..

Answer / hassan-ak

WHERE IS THE INHERITANCE IN THIS CODE, WE KNOW THAT INNER
CLASSES CAN BE DECLARED PRIVATE BUT THE QUESTION IS: CAN IT
BE INHERITED, SINCE A PRIVATE FEILD IS NOT ACCESSED BY SUB
CLASS SO HOW IF THE WHOLE CLASS IS PRIVATE?

Is This Answer Correct ?    1 Yes 0 No

Can we inherit a private class in chsarp? how? explain(with code) ? ..

Answer / amit singh

Private class inherit in the derived class. When we create
instance of that class. Call that instance in derive class.

Is This Answer Correct ?    2 Yes 6 No

Post New Answer

More C Sharp Interview Questions

Can a sealed class be used as a base class?

1 Answers  


What is the functionality of break and continue in Visual Studio?

2 Answers   JPMorgan Chase,


How do I link two windows forms in c#?

1 Answers  


What?s the .NET datatype that allows the retrieval of data by a unique key?

1 Answers  


What are the different types of constructors in c#?

1 Answers  


Explain attributes in c#?

1 Answers  


Why use a singleton instead of static methods?

1 Answers  


I have a very important query in my mind. Please help me regarding this. I don't have any real time exp in .net. But I have a knowledge it .net. I got an offer from an MNC company as a software developer has I had kept 2 years of fake exp. Even though for this job I had worked hard to crack interview for about an year. So, I would like to know how difficult it will be for working in real time as I don't have real time exp. Please tell me as soon as possible bcoz I need to join by next month. Can i sustain over there for a longer time or not. And also let me know how to work pressure will be over there. Please help me regarding this. I'm getting tension thinking about it. Thank you.

1 Answers  


What is unsigned int?

1 Answers  


Explain copy constructor?

1 Answers   Accenture,


What is razor view in c#?

1 Answers  


What are the steps for creating clr trigger

1 Answers  


Categories