Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #12804

Re: wrapper class and N-to-1-uses-a relationship

From ittium <ittium@gmail.com>
Newsgroups comp.lang.c++
Subject Re: wrapper class and N-to-1-uses-a relationship
Date 2011-12-25 10:33 +0530
Organization A noiseless patient Spider
Message-ID <4EF6AEAE.1010300@gmail.com> (permalink)
References <jd25dr$6b6$1@dont-email.me> <Xns9FC579C396910myfirstnameosapriee@216.196.109.131> <jd4lt5$knq$2@dont-email.me> <Xns9FC5B4D48D83Dmyfirstnameosapriee@216.196.109.131>

Show all headers | View raw


On 24-12-2011 PM 09:16, Paavo Helde wrote:
> Victor Bazarov<v.bazarov@comcast.invalid>  wrote in
> news:jd4lt5$knq$2@dont-email.me:
>
>> On 12/24/2011 4:58 AM, Paavo Helde wrote:
>>> ittium<ittium@gmail.com>   wrote in news:jd25dr$6b6$1@dont-email.me:
>>>
>>>> Group,
>>>> I have a small doubt regarding
>>>> http://www.parashift.com/c++-faq-lite/value-vs-ref-semantics.html#faq
>>>> -3 1.4 As per this faq, only valid places(apart from virtual/dynamic
>>>> data) to use reference semantic are
>>>>        - wrapper class
>>>>        -N-to-1-uses-a relationship
>>>> These are generic terms, will appreciate if some one could explain
>>>> or probably direct me to some link. Google search did not offer
>>>> much.
> [...]
>>> With the wrapper classes it is not so clear what the author has
>>> meant. I guess in this context this just means that the A object is
>>> already existing and must remain accessible from other parts of the
>>> program as the A object. Maybe it is a member in some std::map<A>   or
>>> other container. However, other parts of the program want to have
>>> access to the exact same object, but via different interface. As it
>>> might not be possible or feasible to add this interface directly to
>>> the A class, a wrapper class B is defined instead, which provides the
>>> needed interface and forwards the actual function calls to the
>>> original A object. For doing this it must contain a pointer or
>>> reference to the A object.
>>
>> I believe a more appropriate term for the latter is "adapter" instead
>> of "wrapper".  Wrappers *usually* contain the object they "wrap".
>
> Yes, "adaptor" would be more appropriate. Nevertheless, from this FAQ
> section I get a feeling that by "wrapper" they mean just a "class wrapping
> a pointer or reference to an object of another class". But then it seems
> very close to to a tautology to claim that this requires storing a pointer
> or reference.
>
> Cheers
> Paavo
>
Copying it to Marshall Cline, He might like to add something.

Back to comp.lang.c++ | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

wrapper class and  N-to-1-uses-a relationship ittium <ittium@gmail.com> - 2011-12-23 20:36 +0530
  Re: wrapper class and N-to-1-uses-a relationship zindorsky <nephi.allred@gmail.com> - 2011-12-23 11:03 -0800
    Re: wrapper class and N-to-1-uses-a relationship red floyd <no.spam.here@its.invalid> - 2011-12-23 11:29 -0800
      Re: wrapper class and N-to-1-uses-a relationship ittium <ittium@gmail.com> - 2011-12-24 09:18 +0530
  Re: wrapper class and  N-to-1-uses-a relationship Paavo Helde <myfirstname@osa.pri.ee> - 2011-12-24 03:58 -0600
    Re: wrapper class and  N-to-1-uses-a relationship Victor Bazarov <v.bazarov@comcast.invalid> - 2011-12-24 09:00 -0500
      Re: wrapper class and  N-to-1-uses-a relationship Paavo Helde <myfirstname@osa.pri.ee> - 2011-12-24 09:46 -0600
        Re: wrapper class and  N-to-1-uses-a relationship ittium <ittium@gmail.com> - 2011-12-25 10:33 +0530

csiph-web