Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- extern func println( str : string );
- class array< T : typename >
- {
- var m_data : *T;
- var m_size : int32;
- var m_mem : int32;
- property size : int32 = readonly m_size;
- // OR (not used here)
- property size : int32
- {
- func get(){ return m_size; }
- };
- operator [] ( index : int32 ) : &T
- {
- if( index < 0 || index >= m_size )
- {
- WARNING( "array index out of bounds" );
- return T();
- }
- return m_data[ index ];
- }
- };
- func main( args : array<string> )
- {
- for( i = 0; i < args.size; ++i )
- println( args[ i ] );
- println( "Hello, world! (" $ args.size $ ")" );
- }
- func _test()
- {
- main( array<string>{ "array", "data", "test" } );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement