~eda-qa/dhlib/main

« back to all changes in this revision

Viewing changes to haxe/GenericChain.hx

  • Committer: edA-qa mort-ora-y
  • Date: 2010-02-16 05:36:32 UTC
  • Revision ID: eda-qa@disemia.com-20100216053632-60lt7fndfi3fgblw
first

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* <license>
 
2
 * This file is part of the dis-Emi-A HaXe Library. Copyright © edA-qa mort-ora-y
 
3
 * For full copyright and license information please refer to doc/license.txt.
 
4
 * </license> 
 
5
 */
 
6
class Game<Round_T> { 
 
7
        public function new() { } 
 
8
        public function nextRound() : Round_T { return null; }
 
9
}
 
10
 
 
11
class MyRound { 
 
12
        public var value : Int;
 
13
        public function new() { 
 
14
                value = 5;
 
15
        } 
 
16
}
 
17
 
 
18
class HCGame extends Game<MyRound> { 
 
19
        public function new() { 
 
20
                super(); 
 
21
        }
 
22
        //the use of "MyRound" here causes an illegal override in Flash 9
 
23
        override public function nextRound() : MyRound {
 
24
                return new MyRound();
 
25
        }
 
26
}
 
27
 
 
28
class GenericChain extends haxe.unit.TestCase
 
29
{
 
30
        public function textBasic() {
 
31
                var q = new HCGame();
 
32
                assertEquals( 5, q.nextRound().value );
 
33
        }
 
34
}
 
 
b'\\ No newline at end of file'