zaagan
7/14/2019 - 9:44 AM

Dart Type def

Dart Type def

typedef SaySomething(String person, String message);

Shout(String person, String message){
  print('$person: $message');
}

Speak(String person, String message){
  print('$person: $message');
}

Whisper(String person, String message){
  print('$person: $message');
}

/******** Implementation ********/
SaySomething say = Shout;
say('Johnny','Hey Bill !!');
  
say = Speak;
say('Bill', 'Yes, What`s up Johnny Boy !!!');
  
say = Whisper;
say('Librarian', 'Shhhhh!! Don`t make noise !!');

/******** Output 
    Johnny: Hey Bill !!
    Bill: Yes, What`s up Johnny Boy !!!
    Librarian: Shhhhh!! Don`t make noise !!
*/