filmov
tv
9 | Classes & Objects | Python for Complete Beginners

Показать описание
# Creating Class
class MyClass1:
# attributes (data and functions)
pass
class MyClass:
a = 10
def func1(self):
print('Hello')
# Creating Objects
# to access attributes of a class
obj = MyClass()
print(obj.a)
# we can create multiple objects from a class
obj1 = MyClass()
obj2 = MyClass()
print(obj1.a)
print(obj2.a)
obj1.a = 20
obj2.a = 30
print(obj1.a)
print(obj2.a)
# Python is Object Oriented prog language
# Classes and Objects
# Class is a collection of data and functions
# Object is an instance of a class
# Class is a blueprint for an object
class MyClass2:
a = 10
def hello(self):
print('Hello World')
print(MyClass2.a)
class Calculate:
def add(self, num1, num2):
return num1 + num2
def multipy(self, num1, num2):
return num1 * num2
cal1 = Calculate()
▬▬▬▬▬▬
Every Like & Subscription gives me great motivation to keep working for you
You can support my mission for education by sharing this knowledge and helping as many people as you can
If my work has helped you, consider helping any animal near you, in any way you can
Never Stop Learning
Raghav Pal
▬▬▬
class MyClass1:
# attributes (data and functions)
pass
class MyClass:
a = 10
def func1(self):
print('Hello')
# Creating Objects
# to access attributes of a class
obj = MyClass()
print(obj.a)
# we can create multiple objects from a class
obj1 = MyClass()
obj2 = MyClass()
print(obj1.a)
print(obj2.a)
obj1.a = 20
obj2.a = 30
print(obj1.a)
print(obj2.a)
# Python is Object Oriented prog language
# Classes and Objects
# Class is a collection of data and functions
# Object is an instance of a class
# Class is a blueprint for an object
class MyClass2:
a = 10
def hello(self):
print('Hello World')
print(MyClass2.a)
class Calculate:
def add(self, num1, num2):
return num1 + num2
def multipy(self, num1, num2):
return num1 * num2
cal1 = Calculate()
▬▬▬▬▬▬
Every Like & Subscription gives me great motivation to keep working for you
You can support my mission for education by sharing this knowledge and helping as many people as you can
If my work has helped you, consider helping any animal near you, in any way you can
Never Stop Learning
Raghav Pal
▬▬▬
Java Classes & Objects
Java Programming: 9 - Classes and Objects
Classes and Objects with Python - Part 1 (Python Tutorial #9)
9 | Classes & Objects | Python for Complete Beginners
9 Java Objects and Classes Theory |
#21 Class And Object Theory in Java
Introduction to Classes and Objects - Part 1 (Data Structures & Algorithms #3)
Java | Chapter 9 | Objects and Classes
Deference between object and complement | English Grammar For Class 9,10,11 and 12th |By Vivek Sir |
Python Classes and Objects - OOP for Beginners
Object-Oriented Programming, Simplified
#49 Python Tutorial for Beginners | Class and Object
Define Class and Object in java | 30 Days 30 Questions (11) | Placement Series #corejava #interview
What are Classes, Objects, and Constructors?
Learn to program using Ruby - Part 9: Classes and Objects
Using Classes and Objects in Python | Learning Python for Beginners | Code with Kylie #9
Learn to Program 9 : Object Oriented Programming
Python Intermediate Tutorial #1 - Classes and Objects
10 Objects ✒️ in English | Kids English Vocabulary | Adi English Connection #shorts
Objects with different masses fall at the same rate #physics
Fundamental Concepts of Object Oriented Programming
Introduction to Objects & Classes | ICSE Computer Applications | Java & BlueJ
This is SO cool!
Lecture 8 : OOPS in Python | Object Oriented Programming | Classes & Objects | Python Full Cours...
Комментарии