C# (Sharp) Programming Language Question:

Download Job Interview Questions and Answers PDF

If a base class has a bunch of overloaded constructors ...

C# (Sharp) Programming Language Interview Question
C# (Sharp) Programming Language Interview Question

Answer:

If a base class has a bunch of overloaded constructors, and an inherited class has another bunch of overloaded constructors, can you enforce a call from an inherited constructor to an arbitrary base constructor?

Yes, just place a colon, and then keyword base (parameter list to invoke the appropriate constructor) in the overloaded constructor definition inside the inherited class.

Download C# (Sharp) Programming Language Interview Questions And Answers PDF

Previous QuestionNext Question
Can you prevent your class from being inherited and becoming a base class for some other classes?I was trying to use an "out int" parameter in one of my functions. How should I declare the variable that I am passing to it?