What is a simple example of Class? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is a simple example of Class?

27th Jul 2016, 10:06 AM
Barun Mandal
Barun Mandal - avatar
3 Answers
+ 1
class A(object): def f(): print 'foo' a =A() a.f()
29th Oct 2016, 12:41 AM
Shekhar Bahuguna
Shekhar Bahuguna - avatar
0
If you mean really an example which you could google it. BTW class Employee: 'Common base class for all employees' empCount = 0 def __init__(self, name, salary): self.name = name self.salary = salary Employee.empCount += 1 def displayCount(self): print "Total Employee %d" % Employee.empCount def displayEmployee(self): print "Name : ", self.name, ", Salary: ", self.salary
27th Jul 2016, 10:26 AM
MiladDev
MiladDev - avatar
0
Class: Pokemon() Object: Pikachu —Pikachu.thundershock("team rocket meowth")
9th Sep 2016, 2:01 AM
Ryder Wishart
Ryder Wishart - avatar