class and object in python in hindi | object oriented programming in python
In this video you will learn about classes, objects, and constructor in python.
Class and Objects
Python have support for object oriented programming also. So we can implement and use all major concepts of Object Oriented Programming like Class, Object, Inheritance, and Polymorphism etc.
Class
A class is a blueprint or template for creating object. A class is a user defined data type that can contain both variables and functions. The variables are called data members and functions are called member method. The data member of class are accessed by a special parameter inside the member method. This parameter is the first parameter in every member method. Generally name of this parameter is “self” but you can use any other name also.
A class is only a logical construct. It only describes what values can object hold and what methods can be called by the objects. To create a class the class keyword is used. It have following syntax:
class Classname:
#functions-or-member-methods
Object
An object is an instance of the class. It have all the data members and member functions defined by the class. An object takes space in memory and have actual physical existence. So an object is required to use the members of the class.
To create an object of class we use following syntax:
objectname= classname()
To use the member using object we use member access operator (. Operator) between object name and member name:
objectname.function(parameter)
objectname.variable
Constructor or __init__ method of the class
A constructor is a special member of class which is used to create the object of the class. It can also be used to initialize the data members of the class.
In python a constructor have a special name “__init__”. When we create an object of the class, this is automatically called.
s=Student() #Automatically-calls-the __init__-method-and-create-the-object.
Q. i) WAP to create a class to represent student
ii)define __init__ in the class.
iii) initialize three data members : name, roll_number, and age in __init__
iv) define print_details function and print name,roll_number, and age
v) Create an object
vi)print details by calling print_details function with object
#python_by_tarun_sir #tarun_sir #python #tarun_sir_python #python_video_62 #class_and_objects_in_python #python_tutorial #constructor_in_python
Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «class and object in python in hindi | object oriented programming in python», вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.
Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.
Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!
Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.