|
From: Daniel G. <sp...@ho...> - 2002-07-30 17:25:19
|
Ah, but Obj has two data members, which are a text string (which details the precise error) and an integer (which is the error code). SetErrorLog() outputs this information to a text file. I suppose one way would be to make a copy of Obj (Obj2) and then pass obj so Obj2.SetErrorLog( Obj ); >From: "Abhijit Shylanath" <mu...@gm...> >To: "Daniel Glenfield" ><sp...@ho...>,<dev...@li...> >Subject: Re: [Dev-C++] Object passing itself >Date: Tue, 30 Jul 2002 22:16:20 +0530 > >It seems it should work (though I haven't tried it)... though it beats me >why you should pass in an exception object to an exception method... it >defeats the purpose of OOP, that of every object being self-contained. It >should, I feel, be > >Exception::SetErrorLog(); > >-------------------------- >"I'm not as thunk as you drink I am." >-------------------------- >Checked with NAV 2002 >http://mudeth.tripod.com > >----- Original Message ----- >From: "Daniel Glenfield" <sp...@ho...> >To: <dev...@li...> >Sent: Tuesday, July 30, 2002 6:58 PM >Subject: [Dev-C++] Object passing itself > > > > Can an object pass itself into the function it is calling? > > > > void DevModeDlg::OnSysCommand( UINT ID, LPARAM LParameter ) > > { > > try > > { > > DoOnSysCommandWork(); > > } > > catch ( Exception &Obj ) > > { > > Obj.SetErrorLog( &Obj ) // <--- Here > > } > > > > } > > > > > > where SetErrorLog > > > > void Exception::SetErrorLog( Exception &Obj ) > > { > > //... create a text file and put in data contained in Obj. > > } > > > > I tried 'this' but b/c I'm inside another class' function it tries to >pass > > that object (DevModeDlg) _________________________________________________________________ Send and receive Hotmail on your mobile device: http://mobile.msn.com |