Created
September 17, 2018 19:22
-
-
Save pknowledge/40b92a8d11b32d0c2f9d44bb1d9dbd83 to your computer and use it in GitHub Desktop.
Python Aggregation Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Salary: | |
def __init__(self, pay, bonus): | |
self.pay=pay | |
self.bonus=bonus | |
def annual_salary(self): | |
return (self.pay*12) + self.bonus | |
class Employee: | |
def __init__(self, name, age, salary): | |
self.name=name | |
self.age=age | |
self.obj_salary=salary; | |
def total_salary(self): | |
return self.obj_salary.annual_salary() | |
salary = Salary(15000, 10000) | |
emp = Employee('max', 25, salary) | |
print(emp.total_salary()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment