Tutorial by Examples

Once using is used to introduce the name cout from the namespace std into the scope of the main function, the std::cout object can be referred to as cout alone. #include <iostream> int main() { using std::cout; cout << "Hello, world!\n"; }
If a using-declaration occurs at class scope, it is only allowed to redeclare a member of a base class. For example, using std::cout is not allowed at class scope. Often, the name redeclared is one that would otherwise be hidden. For example, in the below code, d1.foo only refers to Derived1::foo(c...
C++11 As a special case, a using-declaration at class scope can refer to the constructors of a direct base class. Those constructors are then inherited by the derived class and can be used to initialize the derived class. struct Base { Base(int x, const char* s); }; struct Derived1 : Base {...

Page 1 of 1