0750デフォルトの名無しさん (ワッチョイ 05bd-4M5M)
2018/12/21(金) 22:42:29.52ID:Co0MMJAt0#include <stdio.h>
class Hoge {
int& m_x;
Hoge(int x) : m_x(x) { }
int operator(int a, int b) const { return a + b + m_x; }
};
int main() {
int X = 10;
Hoge hoge(X);
int c = hoge(2, 3);
printf("c=%d\n", c); // 15
X = 20;
int c2 = hoge(2, 3);
printf("c2=%d\n", c2); // 25
}