From the course: Object-Oriented Programming with C#

Unlock the full course today

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

Items

Items

- [Instructor] Now it's time for us to add something for the player to do. The house will have several items in it, and before we can build them, we'll need to create an abstract class that represents what an item can do. Let's go ahead and create a new folder called items, and add a new items class to it. After we've added our name space, we can go ahead and add the public abstract class item to our file. The first thing we need to do, is create a new property for the items name. Each of the items in our game will have a unique name, that can be used to find it in the inventory. Since we're going to be extending this class, we need to make sure that we use the virtual keyword, so that we can override the name in the children classes. Some items will be single use, meaning they are removed from the inventory after being used. In order to do this, we're going to need to create another property called single use, that's a…

Contents