We Can Inherit all Members Of A Class
No, we cannot inherit private members of a class because private members are accessible only to that class and not outside that class.
Can You Allow A Class To Be Inherited, But Prevent A Method From Being Overridden In C#?
Yes. By Declaring the class public and making the method sealed.
Can we Execute 2 Catch Blocks?
No, we can't! Whenever, an exception occurs in your program, the correct catch block is executed and the control goes to the finally block.
What is true statement about Dispose() Method
Dispose method will be used to free unmanaged resources like files, database connection etc. hence To clear unmanaged resources we need to write code manually to raise dispose() method.
What is true statement about Finalize() Method
Finalize method also free unmanaged resources like database connections, files etc. We need to implement this method whenever we have unmanaged resources in our code and make sure these resources will be freed when garbage collection process done.
What is polymorphism?
polymorphism is the provision of a single interface to entities of different types or the use of a single symbol to represent multiple different types.
If the same message is passed to objects of several different classes and all of those can respond in a different way, what is this feature called?
Its Run time Polymorphism, which allows the same message is passed to objects of several different classes and all of those can respond in a different way, what is this feature called?
Encapsulation is the way to add functions in a user defined structure.
we can’t call these structures if member functions are involved, it must be called class. Also, it is not just about adding functions, it’s about binding data and functions together.
What is abstraction?
Data abstraction is the process of hiding certain details and showing only essential information to the user.
In which access modifier should a constructor use, so that object of the class can be created in any function?
The constructor function should be available to all the parts of the program where the object is to be created. Hence it is advised to define it in public access so that any other function is able to create objects.