Kindly bare if the question is so silly, but i am basically from c/c++ background.
I have the following code.
#!/usr/bin/python
import os
class Logger(object):
def __init__ (self):
print "Constructor of Logger "
def logMsg(self):
print "logMsg::"
class FileLogger (Logger):
def __init__ (self):
print "Constructor of File Logger"
def logMsg (self):
print "FileLogger::"
class FTPLogger (Logger):
def __init__ (self):
print "Constructor of FTP Logger"
def logMsg (self):
print "FTPLogger::"
def logMsg(log):
print "Logging Message"
logHandler.logMsg() # **HERE: HOW POSSIBLE TO ACCESS logHandler Variable?**
logHandler = FileLogger ();
logMsg(logHandler);
Question:
How logMsg() function of FileLogger class be able to access logHandler?.
Can i consider 'logHandler'is a global variable?