Multiple_Inheritence in python

 #

class Employee:
    profession = "Networking"
    var = 10

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

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

    @classmethod
    def change_profession(cls,  newprofessional):
        cls.profession = newprofessional

    @classmethod
    def from_str(clsstring):
        # params = string.split("-")
        # print(params)
        # return cls(params[0],params[1],params[2])
        # how to perform this in one line
        return cls(*string.split("/"))

    @staticmethod
    def printgood(string):
        print("This is good", string)
        return string



umair = Employee("Umair"344"Instructor")
rehman = Employee.from_str("rehman/330/monitor")
# rehman.printgood("Umair")cls

# print (rehman.printdetails())
 


class player:
    var = 11 
    no_of_games = 4
    def __init__(self,name,game):
        self.name = name
        self.game = game 
    def printdetails(self):
        return f"The Name is {self.name}. Game is {self.game }"


hussan = player ("Hussan", ["Football"])


class coleProgramer(playerEmployee):
    # var = 19
    pass

# asif = coleProgramer("Asif", 3000, "CoolProgramer")
asif = coleProgramer("Asif"3000)

# print(asif.printdetails())
print(asif.var)




umair = Employee("Umair"344"Instructor")




Comments