Re: VC++ standard compliance - code

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: BigMan (fn42551_at_fmi.uni-sofia.bg)
Date: 07/11/04

  • Next message: Gidi Nahshoni: "Perl syntax coloring in Visual Studio 6.0"
    Date: Sun, 11 Jul 2004 17:05:07 +0300
    
    

    Thanks for the note on main! In fact, I could not find clause 999.9.9.9.9 of
    ISO/IEC 14882:1998(E). Did you mean 3.6.1.2?

    Now suppose I have 2 versions of a func in the base class: a const one and a
    non-const one. They are both private. Are both versions made public in the
    derived class if I add a using declaration in the public section of the
    derived class? If so, how do I make only one of them public?

    "Sergei" <sergei@nospam.summertime.mtu-net.ru> wrote in message
    news:eRBCaQyZEHA.2840@TK2MSFTNGP11.phx.gbl...
    > Though the void f() declaration in D hides the f name in B, the
    > using declaration brings it back to D. So both f functions are
    > visible and both calls are properly resolved.
    > Note that exception specification is not considered part of
    > a functions type and it's the difference in the type of the implicit
    > object parameter that makes the declarations overloadable.
    > Declaring the main function parameters in any way other
    > then (int argc, char *argv[]) invokes undefined behavior
    > as per clause 999.9.9.9.9 of ISO/IEC 14882:1998(E)
    >
    > Sergei
    >
    > "BigMan" <fn42551@fmi.uni-sofia.bg> wrote in message
    news:ua6Gw9wZEHA.384@TK2MSFTNGP10.phx.gbl...
    > > Here's the code and by the way VC++ 7.1 does compile it:
    > >
    > >
    ////////////////////////////////////////////////////////////////////////////
    > > ///
    > >
    > > class B
    > >
    > > {
    > >
    > > public:
    > >
    > > void f( ) const throw( )
    > >
    > > {
    > >
    > > }
    > >
    > > };
    > >
    > >
    ////////////////////////////////////////////////////////////////////////////
    > > ///
    > >
    > > class D : public B
    > >
    > > {
    > >
    > > public:
    > >
    > >
    > > using B::f;
    > >
    > >
    > > void f( )
    > >
    > > {
    > >
    > > }
    > >
    > > };
    > >
    > >
    ////////////////////////////////////////////////////////////////////////////
    > > ///
    > >
    > > int main
    > >
    > > (
    > >
    > > int NumberOfArguments,
    > >
    > > char** Arguments
    > >
    > >
    > > )
    > >
    > > {
    > >
    > > D a;
    > >
    > > a.f( );
    > >
    > >
    > > D const b;
    > >
    > > b.f( );
    > >
    > >
    > > return 0;
    > >
    > > }
    > >
    > >
    ////////////////////////////////////////////////////////////////////////////
    > > ///


  • Next message: Gidi Nahshoni: "Perl syntax coloring in Visual Studio 6.0"

    Relevant Pages

    • Re: Compiler Warning C4373 about virtual methods
      ... Top-level const qualifiers are ignored in a function declaration. ... derived class: instead of the latter overriding the former, ... where it used to call base class version). ...
      (microsoft.public.vc.language)
    • Re: Compiler Warning C4373 about virtual methods
      ... Top-level const qualifiers are ignored in a function declaration. ... derived class: instead of the latter overriding the former, ...
      (microsoft.public.vc.language)
    • Re: VC++ standard compliance - code
      ... > derived class if I add a using declaration in the public section of the ... >> a functions type and it's the difference in the type of the implicit ... >> object parameter that makes the declarations overloadable. ...
      (microsoft.public.vc.language)
    • Re: polymorph object - why doesnt it work???
      ... Look at this declaration of display, ... You will see that the virtual function in the base class is a const one, ... but the function declared in the derived class is not. ...
      (comp.lang.cpp)
    • Re: Unable to match function definition to an existing declaration
      ... >int main ... if you want the base class types to be conveniently available in ... Then you'll be able to use the bare "size_type" in the derived class. ... Thus, at the point of declaration, the ...
      (microsoft.public.vc.language)