Lets see python syntex how to do it
#privateClassSample.py
class MyClass(): def myPublicFunction(self): print "I am public function" def __myPrivateFunction(self): print "I am private function" class _MyPrivateClass(): def myPrivateFunction(self): print "I am private function of class _MyPrivateClass"
#test.py
from privateClassSample import * a=MyClass() a.myPublicFunction() #b=_MyPrivateClass() # this willl not work, _MyPrivateClass is private class
Output:
I am public function
0 comments:
Post a Comment