(BEGINNER TO ADVANCED)
The concept of object-oriented programming (OOP) in Python. OOP
is a programming paradigm that utilizes objects, which are
instances of classes, to organize code. Python supports OOP
features such as classes, objects, inheritance, polymorphism, and
encapsulation. Everything in Python, including lists, tuples, and
functions, is considered an object. The video focuses on
understanding classes as blueprints or templates for creating
objects and explains how objects can have attributes and
behaviours. The process of creating a class and an object is
demonstrated, and accessing the attributes and methods of an
object is shown.
In this section of the tutorial, the instructor demonstrates the usage
of attributes and methods in Python classes. They execute a method
to obtain a sum of two attributes and proceed to explain the
concept of inheritance. Inheritance allows a class to inherit
attributes and methods from another class, known as the base or
super class. They then create a derived class by passing the base
class inside it.
In this section, the video tutorial introduces the concept of
polymorphism in Python. Polymorphism allows objects of different
classes to be treated as objects of a common base class, and it can
take different forms such as method overload and method
overwriting. The tutorial demonstrates creating a polymorphic
function where both the "my class" and "derived class" objects can
be passed as parameters. This function showcases the
polymorphism concept by providing the sum of the two classes. The
tutorial then briefly mentions encapsulation, which is the concept of
restricting access to certain components of an object by bundling
the data and methods into a single unit.
In this section of the video, the instructor creates an encapsulated
class and demonstrates accessing private attributes through a
public method. They mention that object-oriented programming
(OOP) principles can help in writing modular, reusable, and
maintainable code. The instructor then introduces a real-world
problem of calculating the area and circumference of a circle based
on its radius value. They import a module and create a class to
solve this problem.