fork download
  1. class foo {
  2. func bar<T>(t : T) {
  3. print("the value is \(t)");
  4. }
  5. }
  6.  
  7. class baz: foo {
  8. override func bar<T>(t: T) {
  9. print("lies! the value is \(t)")
  10. }
  11. }
  12.  
  13. func callBar(f: foo, i: Int) {
  14. f.bar(t: i);
  15. }
  16.  
  17. let f = foo();
  18. let b = baz();
  19.  
  20. callBar(f: f, i: 42);
  21. callBar(f: b, i: (42 + 1));
  22.  
Success #stdin #stdout 0s 7324KB
stdin
Standard input is empty
stdout
the value is 42
lies! the value is 43