Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //using inheritance
- class Item //base item class
- {
- string name;
- string description;
- }
- class UsableItem : Item //class that inherits from item and adds functionality to be Used
- {
- public void UseItem()
- {
- //code for using the item
- }
- }
- //not using inheritance (flat)
- class Item
- {
- string name;
- string description;
- bool usable;
- public void UseItem()
- {
- //code for using the item
- }
- //simpler because it's all contained inside one class
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement