Python Class And Methods
Python class and methods are defined as shown in the code below.
--------------------------------------------
#Output
method1
method2 Hello World!
# # Python class and methods # class myClass(): def method1(self): print("method1") def method2(self, someString): print("method2 " + someString) def main(): c = myClass() c.method1() c.method2("Hello World!") if __name__ == "__main__": main()
--------------------------------------------
#Output
method1
method2 Hello World!
Comments
Post a Comment