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 2 of 6 Topic 45758 of 47034
Post > Topic >>

Re: calling "after return"...?

by Branimir Maksimovic <bmaxa@[EMAIL PROTECTED] > May 5, 2008 at 07:28 AM

On May 5, 3:03=A0pm, ".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.

Hope this helps.
Greetings, Branimir.
 




 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 Sat Jul 26 3:02:58 CDT 2008.