C# Programming - Polymorphism - Discussion

Discussion Forum : Polymorphism - General Questions (Q.No. 4)
4.
Which of the following statements is correct?
When used as a modifier, the new keyword explicitly hides a member inherited from a base class.
Operator overloading works in different ways for structures and classes.
It is not necessary that all operator overloads are static methods of the class.
The cast operator can be overloaded.
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
2 comments Page 1 of 1.

Sami said:   1 decade ago
Can anyone please explain A and C? how A is correct any example.

Hung Vu said:   1 decade ago
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:

Your comments will be displayed after verification.