Hi, I've been implementing my own array class,
and I've finally started to use it.
I do have one question,
Array<int> ary1(3);ary1(0)=2;ary1(1)=4;ary1(2)=7; //just an array
Array<int> ary2(3);ary2(0)=1;ary2(1)=2;ary2(2)=6; //just an array
cout << ary1;
cout << ary2;
Array<int> ary3 = ary1+ary2;
cout << ary3;
//everything till this point works
//is this possible
cout << (Array<int>) ary1+ary2;
return 0;
Do I need to assign a temp Array<int> just for outputting.
This is the interface for my code
//member function of Array<T>
std::ostream& dump(std::ostream &o=(std::cout),char sep=' ');
//free function
std::ostream& operator<<(std::ostream &o,Array<T> &a){
return a.dump(o,' ');
}
thanks in advance