C# OOPS INTERVIEW QUESTIONS ANSWERS

C# OOPS INTERVIEW QUESTIONS ANSWERS WITH EXAMPLES

Q-1). We have two classes BaseClass and ChildClass, ChildClass inherit base class. If we make the object of child class then which class's constructor called first?

Ans: Base class constructor will be call first.
rCalledFirst%5B1%5D.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;">

Q-2). Can we declare an Abstract method in non-abstract class?
Ans: No

Q-3). Can we give the return type of constructor?
Ans: No

Q-4). We know that Base class constructor called first. But if we creating object with parameters, and base class have both constructor default and parameterized, then which constructor of baseclass called first.
 Ans: Base class default constructor called first.

Q-5). If we have an abstract method in base class, then we must need to override(or use new keyword) it or not?
Ans: Yes, if we not override it then it give error.

Q-6). Then what you can do that base class parameterized constructor call first.
Ans: We can use "Base" Keyword.

Share on Google Plus

About Unknown

    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment