Inheritance (Exercise) – Learn C#

When you look into a dictionary, the verb inherit means to derive a quality from parents or ancestors. You know, your mom was tall, your dad was tall and you are likely to be tall too. This is exactly what inheritance does even in programming! It’s nothing scary, just instead of a child who inherits the traits of its parents, you have a subclass which inherits members from its base class.

This is an exercise for this YouTube video.

Happy learning and good luck!


Which keyword allows a method in the base class to be overriden in its subclass?
What is the keyword "new" used for? (Choose the most correct answer)


Assignment: Create an Animal class with one method for making sound. Then create a Dog and a Cat (which derive from Animal) and make them bark or meow respectively.

Click to see the answer





Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Development made simple

We're here to help you. If you have any questions, let us know.

Copyright 2017 - 2018 Reso Coder © All Rights Reserved