Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #10466
| From | Philipp Kraus <philipp.kraus@flashpixx.de> |
|---|---|
| Newsgroups | comp.lang.c++ |
| Subject | Re: object copy with reference |
| Date | 2011-09-25 16:25 +0200 |
| Organization | 1&1 Internet AG |
| Message-ID | <j5ndle$rtk$1@online.de> (permalink) |
| References | <j5n445$knm$1@online.de> <j5nb7f$rhs$1@dont-email.me> |
On 2011-09-25 15:44:09 +0200, Victor Bazarov said:
> On 9/25/2011 7:43 AM, Philipp Kraus wrote:
>> I have a class method that is run in different threads:
>> myclass::mythreadmethod( mysuperclass& )
>
> Is there any relationship between 'myclass' and 'mysuperclass'?
No, nothing, exception a myclass object calls methods in the
mysuperclass object.
>
> So, the other class (from which your 'myclass' is derived) requires the
> argument to be a reference to a non-const object. Seems OK. You can
> implement your own
>
> myclass::mythreadmethod_impl(mysuperclass)
>
> by overriding the 'mythreadmethod' this way:
>
> returntype myclass::mythreadmethod(mysuperclass& o)
> {
> mysuperclass local_o(o);
> return this->mythreadmethod_impl(local_o);
> }
>
> (although, strictly speaking, the creation of local_o isn't necessary,
> it's done here just for illustrating the fact of copying the 'o').
That's nice, i will try that. But one question, mysuperclass is a pure
virtual class, so I can't instanciate it directly (sorry, i've forgot
this information in my first posting)
Thanks
Phil
Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
object copy with reference Philipp Kraus <philipp.kraus@flashpixx.de> - 2011-09-25 13:43 +0200
Re: object copy with reference Victor Bazarov <v.bazarov@comcast.invalid> - 2011-09-25 09:44 -0400
Re: object copy with reference Philipp Kraus <philipp.kraus@flashpixx.de> - 2011-09-25 16:25 +0200
Re: object copy with reference Philipp Kraus <philipp.kraus@flashpixx.de> - 2011-09-25 17:59 +0200
Re: object copy with reference Goran <goran.pusic@gmail.com> - 2011-09-26 00:27 -0700
Re: object copy with reference Qi <no@no.no> - 2011-09-26 15:51 +0800
Re: object copy with reference Werner <werasm@gmail.com> - 2011-09-26 01:26 -0700
Re: object copy with reference Werner <werasm@gmail.com> - 2011-09-26 01:32 -0700
Re: object copy with reference Philipp Kraus <philipp.kraus@flashpixx.de> - 2011-09-26 21:02 +0200
Re: object copy with reference Werner <werasm@gmail.com> - 2011-09-26 23:34 -0700
Re: object copy with reference Werner <werasm@gmail.com> - 2011-09-27 02:08 -0700
Re: object copy with reference SG <s.gesemann@gmail.com> - 2011-09-27 04:10 -0700
Re: object copy with reference Werner <werasm@gmail.com> - 2011-09-27 06:56 -0700
csiph-web