Using -keyword

Apr 27, 2011 at 7:29pm
Hi, it´s me again and I have a question about using -keyword and here it is: Is there any different functionality with this keyword than this:

using namespace std;

Should be self-explanatory what this one does, but I´d find it odd if this would be the only functionality using-keyword has. I´ve heard adding new keywords to C++ is not a very welcome thing and that leaves me just wondering this. Any further information about this keyword?
Last edited on Apr 27, 2011 at 7:29pm
Apr 27, 2011 at 7:43pm
with a similar meaning: using std::cout;
Or when you specify in that you want to use a base function in a derived class: using Base::function;
Apr 27, 2011 at 7:56pm
It is just an identifier. In many languages they use the word "import".
Apr 28, 2011 at 3:32am
Sorry for intrusion.


with a similar meaning: using std::cout;
Or when you specify in that you want to use a base function in a derived class: using Base::function;


I know for this one:
1
2
3
4
5
6
7
8
9
10
11
#inlcude <iostream>
int main()
{

    {
        using std::cout;//in this braces scope
        cout << "test";//don't have to write std::
    }
    cout << "test";//ERROR

}


but i don't know how it works with class methods, please share an example.
Apr 28, 2011 at 3:40am
Apr 28, 2011 at 3:42am
Thanks greatly. Never seen that site before.
Apr 28, 2011 at 6:24am
OK, so you can use using -keyword with
- classes
- namespaces
- structures
- unions(?)

The site you suggested Athar is very interesting. Thanks for your comments!
Topic archived. No new replies allowed.