Self function in python using the class

technical talkiess
0

 


Self function in python using the class:-


class Person:

    no_of_money = 8

    # agar apko class ko parameteriied karana hai to aap construtor ka use kar sakte

    def __init__(self,aname,aage,asalary):

        self.name = aname

        self.age = aage

        self.salary = asalary


    # method in the class ..... self function is the object name hai jisko apne isme bheja hai

    def test(self):

        print(f"The name of the person is{self.name} age of the person is {self.age} and salaty of the person is {self.salary}")




vishal = Person("vishal",58,1500)


print(vishal.name)

Post a Comment

0Comments

Thanks you for commenting your questions. I will see question and respond you.

Post a Comment (0)