value_type& operator [] (int location) { return *(sqlist+location); }
// For example, a temp of the value_type, temp [10], is Temp. OPERATOR [] (10 );
Myvector & operator = (myvector & mv) {If (& mv = This) {return * This;} cout <"override =:" <Endl; clear (); for (INT I = 0; I <mV. length; I ++) {pushback (mV. sqlist [I]);} maxsize = getmaxsize (); length = mV. length; return * This;} // M = mV, that is, M. operator = (MV); transmits all the data of the MV to M.
// Display all elements: Friend ostream & operator <(ostream & out, const myvector <t> & RHs) // const-type reference to improve efficiency, the original data cannot be changed. {If (RHS. length = 0) {out <"No element";} else {out <"all of the Members:"; for (INT I = 0; I <RHS. length; I ++) {out <* (RHS. sqlist + I) <";}} return out ;}
// Parameters are in brackets. The symbol overload is the same as the function. cout <myvector; Is cout. Operator <(Out, myvector); returns a reference stream.