Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
464 B
1
Indexable
Never
#include <iostream>
using namespace std;  // Corrected the typo "namespce" to "namespace"

class sample {
public:
    static int a;
    static void getdata() {
        cout << a << endl;
    }
};

int sample::a = 10;

int main() {
    sample s;
    s.getdata(); // Removed the double colons and cout here because getdata is a void function
    sample::a = 100;
    sample::getdata(); // Removed the double colons here and added parentheses for the function call
}