📜  C++ :: - C++ 代码示例

📅  最后修改于: 2022-03-11 14:44:55.329000             🧑  作者: Mango

代码示例1
/* :: is the scope resolution operator
 *
 * It allows to access objects outside of their scope, e.g to implement
 * a function of a class from outside the class
 */

class foo {      // define class named foo
  public:
    foo();       // constructor
    void bar();  // function
};

foo::foo()
{
  // Implement the constructor from outside the class
}

void foo::bar()
{
  // Implement bar from outside the class
}

void bar()
{
  // Implement different bar which is not within the same scope
}