-
November 22nd, 2003, 05:53 PM
#1
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)
-
November 23rd, 2003, 09:50 AM
#2
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|