#include <stdio.h>
struct A {
int c;
int x(int a, int b);
static int y(int a, int b);
A(int x) : c(x) {}
};
int A::x(int a, int b) { return a * b * this->c; }
int A::y(int a, int b) { return a * b /* * this->c */ ; } // 'this' is unavailable for static member function
int main(void) {
A a(5);
printf("%d", a.x(2, 3));
printf("%d", a.y(2, 3)); // *** why can we call this way ? ***
// printf("%d", A::x(2, 3)); // cannot call member function
printf("%d", A::y(2, 3));
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CnN0cnVjdCBBIHsKICBpbnQgYzsKICBpbnQgeChpbnQgYSwgaW50IGIpOwogIHN0YXRpYyBpbnQgeShpbnQgYSwgaW50IGIpOwogIEEoaW50IHgpIDogYyh4KSB7fQp9OwppbnQgQTo6eChpbnQgYSwgaW50IGIpIHsgcmV0dXJuIGEgKiBiICogdGhpcy0+YzsgfQppbnQgQTo6eShpbnQgYSwgaW50IGIpIHsgcmV0dXJuIGEgKiBiIC8qICogdGhpcy0+YyAqLyA7IH0gLy8gJ3RoaXMnIGlzIHVuYXZhaWxhYmxlIGZvciBzdGF0aWMgbWVtYmVyIGZ1bmN0aW9uCmludCBtYWluKHZvaWQpIHsKICBBIGEoNSk7CiAgcHJpbnRmKCIlZCIsIGEueCgyLCAzKSk7CiAgcHJpbnRmKCIlZCIsIGEueSgyLCAzKSk7IC8vICoqKiB3aHkgY2FuIHdlIGNhbGwgdGhpcyB3YXkgPyAqKioKLy8gIHByaW50ZigiJWQiLCBBOjp4KDIsIDMpKTsgLy8gY2Fubm90IGNhbGwgbWVtYmVyIGZ1bmN0aW9uCiAgcHJpbnRmKCIlZCIsIEE6OnkoMiwgMykpOwogIHJldHVybiAwOwp9