Advertisement
narimetisaigopi

what is mixin in telugu

Jan 22nd, 2023
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. void main(List<String> arguments) {
  2. Moderator moderator = Moderator();
  3. moderator.cibiliPoints = 740;
  4. moderator.isHeElgible();
  5. }
  6.  
  7. /**
  8. * User
  9. * Admin
  10. * Moderator
  11. */
  12.  
  13. class User with Authentication {}
  14.  
  15. class Admin with Authentication {}
  16.  
  17. class Moderator with Authentication {}
  18.  
  19. mixin Authentication {
  20. int cibiliPoints = 0;
  21. bool isLogin = false;
  22. setLogin(bool status) {
  23. isLogin = status;
  24. }
  25.  
  26. logout() {
  27. // logout
  28. }
  29.  
  30. getCibilPoints() {}
  31.  
  32. bool isHeElgible() {
  33. if (cibiliPoints > 730) {
  34. return true;
  35. } else {
  36. return false;
  37. }
  38. }
  39. }
  40.  
  41.  
  42.  
  43. /**
  44. * In Dart, a mixin is a way to reuse a class's code in multiple class hierarchies.
  45. * A mixin is defined like a regular class,
  46. * but it is intended to be used as a component of a class rather than a standalone class.
  47. * To use a mixin, a class includes it using the "with" keyword.
  48. * This allows the class that uses the mixin to have access to the mixin's methods and fields,
  49. * as if they were defined in the class itself.
  50. */
  51.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement