Hi,
I have a code that creates a class 'Person' :
class Person:
def __init__(self, fname, lname):
self._fname = fname
self._lname = lname
def fname(self):
return self._fname
def set_fname(self, fname):
self._fname = fname
def lname(self):
return self._lname
def set_lname(self, lname):
self._lname = lname
def name(self):
return self._fname + ' ' + self._lname
What I dont get is what these code blocks do:
def set_fname(self, fname):
self._fname = fname
def set_lname(self, lname):
self._lname = lname
What exactly does the set_fname and set_lname do? and how come the self._fname and self._lname are inaccessible?
Thanks in advance,
ymf