Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
549 B
3
Indexable
Never
#include <iostream>
using namespace std;

class sample {
public:
    static int x;
    static int y;
    int greater(int a, int b) {
        x = a;
        y = b;
        if (x > y) {
            return a;
        }
        return y;
    }
};

int sample::x;
int sample::y;

int main() {
    sample s1, s2, s3;
    cout << "greater is " << s1.greater(1, 2) << endl;
    cout << "greater is " << s1.greater(1, 2) << endl;

    cout << "greater is " << s2.greater(5, 2) << endl;
    cout << "greater is " << s2.greater(5, 2) << endl;

    return 0;
}