Skip to content

Instantly share code, notes, and snippets.

@meysampg
Created March 12, 2015 17:10
Show Gist options
  • Save meysampg/ed3044a076cd5808e50b to your computer and use it in GitHub Desktop.
Save meysampg/ed3044a076cd5808e50b to your computer and use it in GitHub Desktop.
Simple OOP for Saleh
class Human:
age = 0
name = '';
def __init__(self, name, age):
self.name = name
self.age = age
def setAge(self, age):
self.age = age
return self
def setName(self, name):
self.name = name
return self
def getAge(self):
return self.age
def getName(self):
return self.name
if (__name__ == "__main__"):
meysam = Human("Meysam", 25)
print(meysam.getName(),"with",meysam.getAge(),"old.")
meysam.setAge(23).setName("Saleh")
print(meysam.getName(),"with",meysam.getAge(),"old.")
@SirSaleh
Copy link

Thanks Meysam joon :* :*

@meysampg
Copy link
Author

meysampg commented Sep 5, 2019

@SirSaleh Nokaram :* :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment