What does the line int Test::i; does in the below program. Somebody Please Explain
// Assume that integers take 4 bytes.
#include<iostream>
using namespace std;
class Test
{
static int i;
int j;
};
int Test::i;
int main()
{
cout << sizeof(Test);
return 0;
}
That’s the syntax for defining a
staticmember of a class. It initializesTest::ito0.To give it another value, you can do