21. .Can properties be marked as virtual ?
22. What does virtual keyword mean?
They signify that method and property can be overridden.
23. What is the use of “Overrides” and “Overridable” keywords?
Overridable is used in parent class to indicate that a method can be overridden. Overrides is
used in the child class to indicate that you are overriding a method
24. Difference between overloading and overridding.
Overloading is a concept where we can have same method
names with different input signature.
|In overriding we have a parent class with virtual
functions which are overridden in the child classes.
25. What is the difference between ref & out parameters?
An argument passed as ref must be initialized before passing to the method whereas out parameter needs not to be initialized before passing to a method.
26. What is method overloading?
Method overloading is creating multiple methods with the same name with unique signatures in the same class. When we compile, the compiler uses overload resolution to determine the specific method to be invoke.
27. What are the different ways a method can be overloaded?
Methods can be overloaded using different data types for parameter, different order of parameters, and different number of parameters.
28. What is the difference between Shadowing and Overriding?
Overriding redefines only the implementation while shadowing redefines the whole element.
In overriding derived classes can refer the parent class element by using "ME" keyword, but in shadowing you can access it by "MYBASE".
29. What is the difference between compile time polymorphism and run time polymorphism?
Compile time Polymorphism
Compile time Polymorphism also known as method overloading.
Method overloading means having two or more methods with the same name but with different signatures.
Run time Polymorphism
Run time Polymorphism also known as method overriding.
Method overriding means having two or more methods with the same name , same signature but with different implementation.