programplug Logo




Python Object Class


Class

Class describe properties and method of an object.In other world class is a description of an object.Class is a blueprint or a set of instruction to build a specific type of object.

Syntax
class class_name():
   statement 1
   statement 2
   statement 3

Object

Object is self-contained component which consists of methods and properties.In Python is an object, and almost everything has attributes and methods.

Syntax
c=class_name()

Python Class And Object Example-

class School:  
   def __init__(self, rollno, name):  
	  self.rollno = rollno  
	  self.name = name  
   def displaySchool(self):  
	  print "Rollno : ", self.rollno,  ", Name: ", self.name  
s1 = School(1, "Rahul")  
s2 = School(2, "Mohit")  
s1.displaySchool()  
s2.displaySchool()  

output:
Rollno:1,Name:Rahul
Rollno:2,Name:Mohit






Our Services

Developing Cheapest Websites
Offer Digital Marketing
Provide College Projects
Attractive Website Developing
Summer Training,Industrial Training
SCO,SMO

Contact Us

Dehradun Uttarakhand India
www.programplug.com
info@programplug.com
0000000000

Other Link

About Us

Contact Us

Disclaimer

Privacy Policy