What is class and object in Python programming . Python programming language

 Class and object 

In object oriented programming technique the class and object are the main components . As in the procedural programming technique functions are the main aspects . Here in this object oriented programming technique class and object are the main aspects . 

      So now we will see what is object? and what is class ? How to creat it? and all .


What is object?

-> object is nothing but it is the simply collection of data and it's functionality. This object in the object oriented programming technique is similar to the object in the real world 

For example car is a object , ball is a object , house is  object . 

What is data ? 

-> class is nothing but it is just a blue print for object that is using this class we can creat many object .

Now take an example for better understand it 

Example :-

The house is a object and the sketch and prototypes of house is a class .

How to creat class and object ?

-> first to creat a class we need to use keyword class followed by the class name it can be anything . Here class is a keyword and person is my class name than we use pass that means it is an empty class . Now in the main function we will creat a object .

Example :-


class person:
	pass
	
#main
p = person()
print(p

Post a Comment

0 Comments