Monday, October 31, 2016

oop-page2

6.What is Sealed modifiers?

Ans:
Sealed types cannot be inherited & are concrete. Sealed modifiers can also be applied to instance methods, properties, events & indexes. It can't be applied to static members. 
Sealed members are allowed in sealed and non-sealed classes. 

7. What is Inheritance?

Ans:
It provides a convenient way to reuse existing fully tested code in different context thereby saving lot of coding. 
Inheritance of classes in C# is always implementation Inheritance. 

8. What is New modifiers?

Ans:
The new modifiers hides a member of the base class. C# supports only hide by signature. 

9. What is Virtual keyword?

Ans:
This keyword indicates that a member can be overridden in a child class. It can be applied to methods, properties, indexes and events. 

10. What is an Interface?

Ans:
An interface is a contract & defines the requisite behavior of generalization of types. 
An interface mandates a set of behavior, but not the implementation. Interface must be inherited. We can't create an instance of an interface. 
An interface is an array of related function that must be implemented in derived type. Members of an interface are implicitly public & abstract. 
An interface can inherit from another interface. 



11. What is Static Method?

Ans:
It is possible to declare a method as Static provided that they don't attempt to access any instance data or other instance methods. 

12. What is Static field?

Ans:
To indicate that a field should only be stored once no matter how many instance of the class we create. 

13. What is Class?

Ans:
A Class is the generic definition of what an object is a template. 
The keyword class in C# indicates that we are going to define a new class (type of object) 

14. What is Object?

Ans:
Object is anything that is identifiable as a single material item. 

15. Can Struct be inherited?

Ans:
No, Struct can't be inherited as this is implicitly sealed.



<Back  I  Next>


EmoticonEmoticon