Public, Private & Protected Access Specifiers | Python Tutorials For Absolute Beginners In Hindi #63


Code as described/written in the video

# Public -
# Protected -
# Private -

class Employee:
    no_of_leaves = 8
    var = 8
    _protec = 9
    __pr = 98

    def __init__(self, aname, asalary, arole): = aname
        self.salary = asalary
        self.role = arole

    def printdetails(self):
        return f"The Name is {}. Salary is {self.salary} and role is {self.role}"

    def change_leaves(cls, newleaves):
        cls.no_of_leaves = newleaves

    def from_dash(cls, string):
        return cls(*string.split("-"))

    def printgood(string):
        print("This is good " + string)

emp = Employee("harry", 343, "Programmer")

Be the first person to comment!



No downloadable resources for this video. If you think you need anything, please post it in the QnA!

Course Announcements

Any Course related announcements will be posted here

Course Content