Sunday, February 25, 2018

Failing to understand overriding methods.

So I just got started in C# and am having an issue understanding the point of overriding a method. I know how to do it, it’s just that, what is the point? Why wouldn’t you just not inherit and just make a separate class outside of the base class with the same method name? All I’m seeing is that it allows you to name a method in a derived class with a method name already being used in the base class. I get overloading, that’s really cool and I have found it extremely useful, but why overriding? When would someone ever need to override a method? Why would they ever need to? When would someone ever use this in production? What is the benefit here? I love polymorphism, but why? Give me an example of when this would be useful.

Failing to understand overriding methods. Click here
  • Blogger Comment
  • Facebook Comment

0 comments:

Post a Comment

The webdev Team