Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/134.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ using声明能否区分重载函数?_C++ - Fatal编程技术网

C++ using声明能否区分重载函数?

C++ using声明能否区分重载函数?,c++,C++,我想做一些类似的事情: struct Base{ private: int x_; public: Base& x(int x) { x_=x; return *this; } int x() const { return x_; } }; struct Derived : private Base { public: using Base::x; //just the getter? private: using Base::x; //the setter };

我想做一些类似的事情:

struct Base{
private:
  int x_;
public:
  Base& x(int x) { x_=x; return *this; }
  int x() const { return x_; } 
};

struct Derived : private Base {
public:
  using Base::x; //just the getter?
private:
  using Base::x; //the setter
};

使用声明会引入名称,而不是重载。重载是指使用相同的名称来表示多个事物。所以不是。使用声明会引入名称,而不是重载。重载是指使用相同的名称来表示多个事物。所以没有。