Commit fdb42310 by Tianqi Yang

test(overload): add positive tests for overload

Add test cases: - overload_single1: Tests of overloads functions with single parameters - overload_multi1: Tests of overloaded functions with multiple parameters
parent d865c6ed
class A
{
void print ()
{
Print ( "A.print\n" );
}
}
class B extends A
{
void print ()
{
Print ( "B.print\n" );
}
}
class F
{
static void f ( class A a, class A b )
{
Print ( "F: A A\n" );
a.print ();
b.print ();
}
}
class G
{
static void f ( class A a, class A b )
{
Print ( "G: A A\n" );
}
static void f ( class A a, class B b )
{
Print ( "G: A B\n" );
}
static void f ( class B a, class A b )
{
Print ( "G: B A\n" );
}
static void f ( class B a, class B b )
{
Print ( "G: B B\n" );
}
}
class Main
{
static void main ()
{
class A a;
a = new A ();
class B b;
b = new B ();
F.f ( a, a );
F.f ( a, b );
F.f ( b, a );
F.f ( b, b );
G.f ( a, a );
G.f ( a, b );
G.f ( b, a );
G.f ( b, b );
}
}
\ No newline at end of file
class A
{
int f ( int a )
{
return 1;
}
int f ( string a )
{
return 2;
}
}
class B extends A
{
int f ( int a )
{
return 3;
}
int f ( bool a )
{
return 4;
}
}
class Main
{
static void main ()
{
class A a;
a = new A ();
Print ( a.f ( 1 ) );
Print ( a.f ( "1" ) );
class B b;
b = new B ();
Print ( b.f ( 1 ) );
Print ( b.f ( "1" ) );
Print ( b.f ( true ) );
}
}
\ No newline at end of file
F: A A
A.print
A.print
F: A A
A.print
B.print
F: A A
B.print
A.print
F: A A
B.print
B.print
G: A A
G: A B
G: B A
G: B B
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment