スタックを使用した次の様なコード.
stack_s so ;
エラー情報を指定する様に変更してビルド.
i_error ie ; stack_s so(&ie) ;
--------------------Configuration: t_stack - Win32 Debug-------------------- Compiling... t_stack.cpp d:\document\vs\vs\1998\t_stack\t_stack\t_stack.cpp(14) : error C2664: '__thiscall stack_s::stack_s(const class stack_s &)' : cannot convert parameter 1 from 'class i_error *' to 'const class stack_s &' Reason: cannot convert from 'class i_error *' to 'const class stack_s' No constructor could take the source type, or constructor overload resolution was ambiguous Error executing cl.exe. T_stack.exe - 1 error(s), 0 warning(s)
C2664 になってしまう.
class stack_b { public: stack_b (i_error* i_err=NULL) { ie = &tmp_ie ; if(i_err != NULL) { ie = i_err ; } } protected: i_error tmp_ie ; i_error* ie ; } ; class stack_s : public stack_b { public: // stack_s (i_error* i_err=NULL) : stack_b (i_err) { ; } public: virtual bool push (c_tstring& s) ; virtual tstring pop (void) ; virtual tstring last (void) ; protected: s_tstring stck_s ; } ;