Syntax error : System verilog keyword 'void' is not expected to b used in this context

In reply to debuggerzc:

Because your member ‘mode1’ is defined in a static function, not in class A. You still mixed the syntax between C and SV. If you want to use a string in class , you wont define it in a main function. That is wrong.
This code maybe fit for you:

class A;
string mode1[3]=xxxxx;
string mode2[2]=xxxxx;
endclass : A

class B;

endclass : B

class C;
A test_mode;
B printing;
test_mode = new();
printing = new();
printing.print_it(test_mode.mode1);
endclass:C

You can try it again.