From the course: Advanced C#: Object-Oriented Programming

Unlock the full course today

Join today to access over 24,800 courses taught by industry experts.

Abstract methods and properties

Abstract methods and properties - C# Tutorial

From the course: Advanced C#: Object-Oriented Programming

Abstract methods and properties

- [Instructor] In a previous video, we saw how to use abstract classes to provide a basic foundation for a class structure that prevents developers from instantiating the base class itself. But we ran into a problem. Developers were able to create and instantiate derived classes that didn't override certain members of the abstract base class that we want them to. So what we want to be able to do is specify that there are certain members of the base class that have to be implemented by the derived classes. To do this, we can use the abstract keyword that we learned about earlier to define specific base class members that must be implemented by subclasses. So here in our code in the abstract props funks folder let's open up our program and vehicle files. So let's take a look at the code for our vehicles class that we saw earlier. It's mostly the same with some slight changes. So I added a property for the number of wheels…

Contents