Python Programming - Classes - Discussion
Discussion Forum : Classes - General Questions (Q.No. 24)
24.
Consider the following Python code:
class Circle:
def __init__(self, radius):
self.radius = radius
def area(self):
return 3.14 * self.radius**2
class ColoredCircle(Circle):
def __init__(self, radius, color):
super().__init__(radius)
self.color = color
What concept of object-oriented programming is exemplified in this code?
Answer: Option
Explanation:
The code demonstrates the concept of inheritance, where the `ColoredCircle` class inherits from the `Circle` class, acquiring its methods and attributes.
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