Previous Next

Python OOPS

OOPS is an abbreviation for Object Oriented Programming System. It is a programming approach that employs objects and classes in programming.

Class

A class is a template for making objects. It can be declared with the class keyword, then the class name and a colon.

Example:

class Student:
    name = "Arka"
    age = 22

Objects

An object is an example of a class.

Example:

class Student:
    name = "Arka"
    age = 22

obj1 = Student()
print(obj1.name)

Output:

Arka
Previous Next