Sunday, October 11, 2009
OOPS - Part - 3
1) How do you refer to a member in the base class?
To refer to a member in the base class use:return base.NameOfMethod().
2) In terms of constructors, what is the difference between: public MyDerived() : base() an public MyDerived() in a child class?
3) What is the default accessibility for a class?
internal for a top level class, private for a nested one.
4) What is an out parameter? What is difference between out and ref parameter?
An out parameter allows an instance of a parameter object to be made inside a method. Reference parameters must be initialised but out gives a reference to an uninstanciated object.
5) What is polymorphism?
Polymorphism is the ability to implement the same operation many times. Each derived method implements the operation inherited from the base class in its own way.
6) Can abstract methods override virtual methods?
7) What are attributes?
Attributes are declarative tags which can be used to mark certain entities (like methods for example).