The conversation between human and AI assistant.
How does procedural programming differ from object-oriented programming?
Can you give an example of inheritance in object-oriented programming?
Sure. Inheritance is the practice of creating a new class that is a modified version of an existing class. The new class inherits all of the properties and methods of the existing class and can add or modify them as needed. For example, you could have a base class called Animal that defines basic properties like name and age, and then create a subclass called Dog that adds properties like breed and bark().