【发布时间】:2014-04-04 07:46:28
【问题描述】:
例如,我有时会使用“Set”后缀,像这样:
ClassA
{
public:
ClassA(int xSet, int ySet):
x(xSet),
y(ySet)
{
;
}
private:
int x, y;
};
那么,有没有更好的写 xSet 和 ySet 的方法?
【问题讨论】:
-
为什么不简单地使用相同的名称?使用
this->x(x)初始化成员。
标签: c++ constructor identifier notation