~extremepopcorn/dhlib/dhlib_ep

« back to all changes in this revision

Viewing changes to haxe/Typing.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 (c) edA-qa mort-ora-y
 
3
 * For full copyright and license information please refer to doc/license.txt.
 
4
 * </license> 
 
5
 */
 
6
class Type<T>
 
7
{
 
8
        public var a : T;
 
9
 
 
10
        public function new( b : T ) 
 
11
                { a = b; } 
 
12
        
 
13
        public function add( b : Type<T> ) : Type<T>
 
14
                { 
 
15
                        //cannot add here, that is annoying...
 
16
                        var n = a + b.a;
 
17
                        return new Type<T>( n ); 
 
18
                }
 
19
}
 
20
 
 
21
class Typing
 
22
{
 
23
        static public function main()
 
24
        {
 
25
                var a = new Type<Float>(5);
 
26
                var c = a.add( new Type<Float>(6) );
 
27
        }
 
28
}