Course Content

If you are facing any issue in playing video please use Firefox browser.

Course Content

Description

Python Classes and Objects

 

In this lecture we will see that, What is Class and Object ?, How to use them ? & How to delete objects ?

 

Classes and Objects are important for OOPS concepts and is very first topic for that.

 

As python is object oriented programming language, so if we want to work through object we need to make class.

 

Python is an object oriented programming language. Unlike procedure oriented programming, where the main emphasis on functions, object oriented programming stress on objects.

 

Object is simply a collection of data (variables) and methods (functions) that act on those data. And, Class is a blueprint for the object.

 

Defining a class in Python

 

class MyNewClass:

'''This is a docstring. I have created a new class'''

Pass

 

Example of class in Python

 

class MyClass:

"This is my second class"

a=10

def func(self):

print('Hello')

print(Myclass.a)

print(MyClass._doc_)

 

Creating an Object in Python

 

The class object could be used to access different attributes like methods, functions, etc...

ob=MyClass()

 

To call function

ob.func()

 

Removing an Object in Python

 

ob=MyClass()

del ob;

 

After del ob your object removed from your namespace.

FAQs

Share With Friend

Have a friend to whom you would want to share this course?

Download The Apps

Code Scan or Download the app
Google Play Store
297K+ Downloads
4.5 Rating
10K+ Reviews
  • Learn anywhere on the go
  • Get regular updates about your enrolled or new courses
  • Share content with your friends
  • Evaluate your progress through practice tests
  • No internet connection needed
  • Enroll for the webinar and join at the time of the webinar from anywhere