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.

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.

okay thx for tips! now im understand :D

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.