Easy Tutorial
❮ Zookeeper Node Feature Verilog2 Timing Check ❯

Usage of :: in C++

Category Programming Techniques

This is the scope resolution operator. It is used to reference static member functions outside the class or to define member functions outside the class. It is also used to access types or functions within namespaces (e.g., std::cout, std::cin, std::string, etc.).

Example

class Test{
public:
    Test();
    static void print() 
    {
        std::cout<<"Test"<&lt;endl; // Using :: for namespaces
    }
private:
    int a;
};
Test::Test() : a(1)   // Using :: for definition
{}
Test::print();  // Using :: for static member functions
❮ Zookeeper Node Feature Verilog2 Timing Check ❯