Topic: <functional> question


Author: Valentin Bonnard <bonnardv@pratique.fr>
Date: 1998/05/19
Raw View
Howard Hinnant wrote:

> All of the arithmetic operations in <functional> derive from
> unary_function and binary_function privately.

Do they ? Hopefully no.

You frigtened me. The keyword private doesn't even appear in
this chapter (20: General utilities library).

Please don't make me fear like that.

--

Valentin Bonnard                mailto:bonnardv@pratique.fr
info about C++/a propos du C++: http://pages.pratique.fr/~bonnardv/


[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]






Author: Alexandre Oliva <oliva@dcc.unicamp.br>
Date: 1998/05/19
Raw View
Howard Hinnant <hinnant@_anti-spam_lightlink.com> writes:

> All of the arithmetic operations in <functional> derive from
> unary_function and binary_function privately.

Since they're declared as structs, inheritance is public by default.

--
Alexandre Oliva
mailto:oliva@dcc.unicamp.br mailto:aoliva@acm.org
http://www.dcc.unicamp.br/~oliva
Universidade Estadual de Campinas, SP, Brasil


[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]






Author: hinnant@_anti-spam_lightlink.com (Howard Hinnant)
Date: 1998/05/19
Raw View
In article <356180EA.6A93@pratique.fr>, Valentin Bonnard
<bonnardv@pratique.fr> wrote:

> Howard Hinnant wrote:
>
> > All of the arithmetic operations in <functional> derive from
> > unary_function and binary_function privately.
>
> Do they ? Hopefully no.
>
> You frigtened me. The keyword private doesn't even appear in
> this chapter (20: General utilities library).
>
> Please don't make me fear like that.

Sorry, should've looked it up.  I never knew the rule about structs
defaulting to public derivation.  Learn something new every day!

-Howard


[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]






Author: hinnant@_anti-spam_lightlink.com (Howard Hinnant)
Date: 1998/05/20
Raw View
In article <356180EA.6A93@pratique.fr>, Valentin Bonnard
<bonnardv@pratique.fr> wrote:

> Howard Hinnant wrote:
>
> > All of the arithmetic operations in <functional> derive from
> > unary_function and binary_function privately.
>
> Do they ? Hopefully no.
>
> You frigtened me. The keyword private doesn't even appear in
> this chapter (20: General utilities library).
>
> Please don't make me fear like that.

At the risk of raising your blood pressure, the keyword public doesn't
appear in the "Arithmetic" section either.  If the type of derivation
isn't specified, does it not default to private?  Perhaps I have missed a
standards change, or am just not remembering the rules correctly.

-Howard
---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]





Author: nimel@my-dejanews.com
Date: 1998/05/20
Raw View
In article <hinnant-1905981825140001@port17.lightlink.com>,
  hinnant@_anti-spam_lightlink.com (Howard Hinnant) wrote:
>
> In article <356180EA.6A93@pratique.fr>, Valentin Bonnard
> <bonnardv@pratique.fr> wrote:
>
> > Howard Hinnant wrote:
> >
> > > All of the arithmetic operations in <functional> derive from
> > > unary_function and binary_function privately.

No. See below.

> > Do they ? Hopefully no.

Rest assured. They don't.

> > You frigtened me. The keyword private doesn't even appear in
> > this chapter (20: General utilities library).
> >
> > Please don't make me fear like that.
>
> At the risk of raising your blood pressure, the keyword public doesn't
> appear in the "Arithmetic" section either.  If the type of derivation
> isn't specified, does it not default to private?  Perhaps I have missed a
> standards change, or am just not remembering the rules correctly.

struct A : B { }; // public inheritance
class A : B { }; // private inheritance

The standard header <functional> is using struct to define the
arithmetic classes.

/Niklas Mellin

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]






Author: jkanze@otelo.ibmmail.com
Date: 1998/05/20
Raw View
In article <356180EA.6A93@pratique.fr>,
  Valentin Bonnard <bonnardv@pratique.fr> wrote:
>
> Howard Hinnant wrote:
>
> > All of the arithmetic operations in <functional> derive from
> > unary_function and binary_function privately.
>
> Do they ? Hopefully no.
>
> You frigtened me. The keyword private doesn't even appear in
> this chapter (20: General utilities library).

It doesn't have to.  For classes, private inheritance is the default.
Not to worry, though.  In this case, the arithmetic operators are
declared as struct, so the default inheritance is public.

Personally, I'd have preferred that the public appear explicitly.
But it doesn't make any difference with regards to the actual meaning.

--
James Kanze    +33 (0)1 39 23 84 71    mailto: kanze@gabi-soft.fr
        +49 (0)69 66 45 33 10    mailto: jkanze@otelo.ibmmail.com
GABI Software, 22 rue Jacques-Lemercier, 78000 Versailles, France
Conseils en informatique orient=E9e objet --
              -- Beratung in objektorientierter Datenverarbeitung

-----=3D=3D Posted via Deja News, The Leader in Internet Discussion =3D=3D=
-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]






Author: jcoffin@taeus.com (Jerry Coffin)
Date: 1998/05/20
Raw View
In article <hinnant-1905981825140001@port17.lightlink.com>,
hinnant@_anti-spam_lightlink.com says...

[ ... ]

> At the risk of raising your blood pressure, the keyword public doesn't
> appear in the "Arithmetic" section either.  If the type of derivation
> isn't specified, does it not default to private?  Perhaps I have missed a
> standards change, or am just not remembering the rules correctly.

In a struct, members whether included explicitly or by derivation, are
public by default.  In a class, members (again, regardless of whether
included explicitly or by derivation) are private by default.  In this
case, we're looking at struct's instead of classes, so the members
default to public.

--
    Later,
    Jerry.

The Universe is a figment of its own imagination.


[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]






Author: hinnant@_anti-spam_lightlink.com (Howard Hinnant)
Date: 1998/05/19
Raw View
All of the arithmetic operations in <functional> derive from
unary_function and binary_function privately.  Is this a type-o in the
standard?  Or do the typedef's in the base class not follow the same
access rules as member names?

Thanks,
Howard
---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]