What is Object:
Physical existence of a class is nothing but object. We can create any number of
objects for a class.
Syntax to create object: referencevariable = classname()
Example: s = Student()
What is Reference Variable:
The variable which can be used to refer object is called reference variable.
By using reference variable, we can access properties and methods of object.
Program: Write a Python program to create a Student class and Creates an object to
it. Call the
method talk() to display student details
1) class Student:
2)
3) def __init__(self,name,rollno,marks):
4) [Link]=name
5) [Link]=rollno
6) [Link]=marks
7)
8) def talk(self):
9) print("Hello My Name is:",[Link])
10) print("My Rollno is:",[Link])
11) print("My Marks are:",[Link])
12)
13) s1=Student("amol",101,80)
14) [Link]()