C# Programming - Polymorphism - Discussion

Discussion :: Polymorphism - General Questions (Q.No.4)


Which of the following statements is correct?

[A]. When used as a modifier, the new keyword explicitly hides a member inherited from a base class.
[B]. Operator overloading works in different ways for structures and classes.
[C]. It is not necessary that all operator overloads are static methods of the class.
[D]. The cast operator can be overloaded.

Answer: Option A


No answer description available for this question.

Sami said: (Jan 5, 2014)  
Can anyone please explain A and C? how A is correct any example.

Hung Vu said: (May 18, 2015)  
When used as a declaration modifier, the new keyword explicitly hides a member that is inherited from a base class. When you hide an inherited member, the derived version of the member replaces the base class version.

Although you can hide members without using the new modifier, you get a compiler warning. If you use new to explicitly hide a member, it suppresses this warning.

Post your comments here:

Name *:

Email   : (optional)

» Your comments will be displayed only after manual approval.