Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C++ > Re: calling "af...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 6 of 6 Topic 45758 of 47032
Post > Topic >>

Re: calling "after return"...?

by "Eric.Malenfant@[EMAIL PROTECTED] " <Eric.Malenfant@[EMAIL PROTECTED] > May 5, 2008 at 07:56 AM

On May 5, 10:28 am, Branimir Maksimovic <bm...@[EMAIL PROTECTED]
> wrote:
> On May 5, 3:03 pm, ".rhavin grobert" <cl...@[EMAIL PROTECTED]
> wrote:
>
> > [insert ya favorite greetin' here;-)]
>
> Hi
>
> > when some does a...
>
> > A.GetB()->AMethodOfB();
>
> > ... and you want some code be executed before B::AMethodOfB() is
> > called, you simply pack it into A::GetB()'s body before the return.
> > But what do yuo do, if you want to execute some code _after_ B's
> > method is executed, e.g. when the callstack - after completing the
> > call into B - returns back into A::GetB()?
>
> It is not called from GetB, therefore does not
> returns there.
> Instead of returning B* directly, return
> object by value that returns B* from overrided operator -> ,
>  and place your entry code in constructor, exit code
> in destructor of that object.

Stroustrup wrote a paper about this technique a while ago: "Wrapping C+
+ Member Function Calls": http://www.research.att.com/~bs/wrapper.pdf
 




 6 Posts in Topic:
calling "after return"...?
".rhavin grobert&quo  2008-05-05 06:03:07 
Re: calling "after return"...?
Branimir Maksimovic <b  2008-05-05 07:28:40 
Re: calling "after return"...?
gw7rib@[EMAIL PROTECTED]   2008-05-05 07:31:11 
Re: calling "after return"...?
Ben Bacarisse <ben.use  2008-05-05 15:42:18 
Re: calling "after return"...?
pjb@[EMAIL PROTECTED] (P  2008-05-05 16:53:12 
Re: calling "after return"...?
"Eric.Malenfant@[EMA  2008-05-05 07:56:21 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Jul 25 21:52:30 CDT 2008.