Advertisement
Hiteshw11

Concat Two Strings Using Generic Function

Nov 29th, 2024
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Dart 0.24 KB | Source Code | 0 0
  1. // concat two strings using generic function
  2.  
  3.  
  4. void main()
  5. {
  6. var a =OneString();
  7. print(a.concat('Hitesh','Wadhwa'));
  8.  
  9. }
  10.  
  11. class OneString
  12. {
  13. OneString();
  14.  
  15. T concat<T extends String>(T b, T c)
  16. {
  17.  
  18. return(b+' '+c) as T;
  19. }
  20.  
  21.  
  22. }
Tags: dart
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement