Computer Science Canada Any language welcome challenge |
Author: | wtd [ Tue Feb 05, 2008 11:38 pm ] |
Post subject: | Any language welcome challenge |
Well, any language in which one can write a program that satisfies the problem description. Create a generic class Foo which takes as its type parameter T any class which answers to a method "baz" which returns an integer. The generic class Foo must have a constructor which takes an object of type T, storing that as "x". Foo must have a method qux which returns the result of multiplying x's baz method's return value by three. |
Author: | rdrake [ Tue Feb 05, 2008 11:40 pm ] |
Post subject: | RE:Any language welcome challenge |
Are we to post our solutions here? |
Author: | wtd [ Wed Feb 06, 2008 12:28 am ] | ||
Post subject: | Re: Any language welcome challenge | ||
Yes. To kick it off:
|
Author: | rdrake [ Wed Feb 06, 2008 1:20 am ] | ||
Post subject: | Re: Any language welcome challenge | ||
Good old C# 2.0:
|
Author: | OneOffDriveByPoster [ Wed Feb 06, 2008 11:11 am ] | ||
Post subject: | Re: Any language welcome challenge | ||
|
Author: | wtd [ Wed Feb 06, 2008 5:43 pm ] |
Post subject: | RE:Any language welcome challenge |
Excellent. |
Author: | rdrake [ Fri Feb 08, 2008 3:46 am ] | ||
Post subject: | RE:Any language welcome challenge | ||
Improved C# 3.0 version:
EDIT: Dan, why does uppercase Test get changed to just lowercase test? |
Author: | wtd [ Fri Feb 08, 2008 1:34 pm ] | ||
Post subject: | Re: Any language welcome challenge | ||
Scala:
|
Author: | rdrake [ Sat Feb 09, 2008 1:24 am ] | ||
Post subject: | Re: Any language welcome challenge | ||
Another:
|