Python Programming - Encapsulation - Discussion
Discussion Forum : Encapsulation - General Questions (Q.No. 85)
85.
Consider the following Python code:
class Temperature:
def __init__(self, __celsius):
self.__celsius = __celsius
def to_fahrenheit(self):
return (self.__celsius * 9/5) + 32
What is the purpose of the to_fahrenheit() method?
Answer: Option
Explanation:
The to_fahrenheit() method converts the temperature from Celsius to Fahrenheit, demonstrating encapsulation.
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