Skip to content

Instantly share code, notes, and snippets.

@NishadAvnish
Last active September 24, 2024 10:15
Show Gist options
  • Save NishadAvnish/76efd0c7aa8b0a1b5c5c01553dd09f12 to your computer and use it in GitHub Desktop.
Save NishadAvnish/76efd0c7aa8b0a1b5c5c01553dd09f12 to your computer and use it in GitHub Desktop.
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