Last active
September 24, 2024 10:15
-
-
Save NishadAvnish/76efd0c7aa8b0a1b5c5c01553dd09f12 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
mixin Activity{ | |
void caloriesLeft(doble totalCalories,double burnedCalories){ | |
return totalCalories-burnedCalories; | |
} | |
} | |
// our main class- this is just an example | |
// please make seperate file for mixin | |
class Person with Activity{ | |
double totalCalories=200; | |
double burnedCalories=20; | |
// call the method here in this class, | |
// because we have injected it using "with" keyword. | |
totalcalories= caloriesLeft(totalCalories,burnedCalories); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment