Python Programming - Classes - Discussion
Discussion Forum : Classes - General Questions (Q.No. 30)
30.
Consider the following Python code:
class Book:
def __init__(self, title, author):
self.title = title
self.author = author
class EBook(Book):
def __init__(self, title, author, format_type):
super().__init__(title, author)
self.format_type = format_type
What object-oriented principle is evident in this code?
Answer: Option
Explanation:
The code illustrates the concept of inheritance, where the `EBook` class inherits from the `Book` class, inheriting its attributes and methods.
Discussion:
Be the first person to comment on this question !
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers