1.

Methods of a class that provide access to private members of the class are called as ______ and ______(a) getters/setters(b) __repr__/__str__(c) user-defined functions/in-built functions(d) __init__/__del__This question was posed to me in class test.This question is from Encapsulation topic in section Classes and Objects, Inheritance, Polymorphism, Encapsulation and Exception Handling of Python

Answer» RIGHT choice is (a) getters/setters

To EXPLAIN I would say: The PURPOSE of getters and setters is to get(RETURN) and SET(assign) private instance variables of a class.


Discussion

No Comment Found

Related InterviewSolutions