Python Class & Object Tutorial
In general a class is
defined as grouping of objects having identical properties, common behavior,
and shared some relationships to perform a specified task. For example,
a computer system, a vehicle etc.
But in programming
point of view a class is a user-defined data type which fully defines an
object. That means without a class, we cant declare an object
An object is also
called an instance of a class and the process of creating this object is known
as instantiation.
Once a class is
declared, we can declare any no of objects belonging to that class.
Syntax to declare an object: object_name=class_name()
Example-2:
Note:
When we
define a function inside a class, it is mandatory to pass a self keyword as
parameter to function. The self keyword act as a pointer which points to the
current instance(object). That means what ever the object contains data, that
data member will access by self keyword using dot operator.
Regards:
Trilochan
Tarai
Silan
Technology, BBSR
Call Us-
0674-2361252
Comments
Post a Comment