Shashank Shashank - 11 months ago 58
C++ Question

Passing an array of objects to Member Function in c++

I use Turbo C++ and am experiencing an unexpected error in my code, please help..
I am trying to pass an array of objects to a member function.
An error : Undefined structure test , pops on the line where i define my print function


class test
int t;
void print(test T[])
cout<<"This Test\n";
void main()
test T1,T2[5];

I have to use the outdated version of the Turbo C++ compiler at school so the syntax of the code might be different than the new compilers.


Define your function as void print(test *T).

Turbo C++ is broken in the regard of parameters of type test[] being equivalent to test*.