Untitled
unknown
plain_text
2 years ago
464 B
6
Indexable
#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
}
Editor is loading...