erm i learn new thing, its a bad idea to use "using directive" inside a class declaration, because this can leads to ambiguous functions/statements inside the main program.

using namespace std; 

the question is, is it okay to use "using declaration" inside a class declaration?
such as :

using std::cout;
using std::endl;

in my mind, i think its okay, but im not really sure about it.

Edited 4 Years Ago by Sendy Hipo

erm i learn new thing, its a bad idea to use "using directive" inside a class declaration, because this can leads to ambiguous functions/statements inside the main program.

That argument only applies if you reuse standard library names, which generally isn't a good idea in the first place. While I don't disagree entirely with the advice to limit using directives, I think you should avoid the underlying problem instead of Band-Aid it.

the question is, is it okay to use "using declaration" inside a class declaration?

It's better in that you have more control over which names from the library are exposed. The using declaration lets you choose names onesie twosie while the using directive will pull in everything whether you want it or not.

This question has already been answered. Start a new discussion instead.