CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2003
    Location
    Pasadena, CA
    Posts
    48

    Quick question about 'using'

    Can using be used to make public a public method of an a member object?

    class foo {void bar() {}};

    class doink {public: void bar(){Foo.bar();} private: foo Foo;}

    can 'doink' be built like this instead?

    class doinkUsing {public: using Foo.? private: foo Foo;}


    yeah, I know how to use using with ancestor classes - just wanted to know if it could be used to avoid writing forwarding functions.
    The views expressed are those of the author and do not reflect any position taken by the Goverment of the United States of America, National Aeronautics and Space Administration (NASA), Jet Propulsion Laboratory (JPL), or California Institute of Technology (CalTech)

  2. #2
    Join Date
    Apr 1999
    Location
    Altrincham, England
    Posts
    4,470
    Assuming that you left out the inheritance for doink and doinkUsing accidentally, then yes AFAIK. However - you can't selectively use overloaded functions from the base class - the using syntax means that it's all or none.
    Correct is better than fast. Simple is better than complex. Clear is better than cute. Safe is better than insecure.
    --
    Sutter and Alexandrescu, C++ Coding Standards

    Programs must be written for people to read, and only incidentally for machines to execute.

    --
    Harold Abelson and Gerald Jay Sussman

    The cheapest, fastest and most reliable components of a computer system are those that aren't there.
    -- Gordon Bell


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured