class Foo
{
public:
// single parameter constructor, can be used as an implicit conversion
Foo (int foo) : m_foo (foo)
{
}
int GetFoo () { return m_foo; }
private:
int m_foo;
};
Run Code Online (Sandbox Code Playgroud)
m_foo是私有部分中定义的整数,但是m_foo(foo)是什么?看起来像一个功能.
m_foo既是整数又是函数?这是如何运作的?
而Foo(int foo)构造函数正在扩展m_foo函数.