//: C10:Statinit.cpp
// From Thinking in C++, 2nd Edition
// Available at http://www.BruceEckel.com
// (c) Bruce Eckel 2000
// Copyright notice in Copyright.txt
// Scope of static initializer

#include <iostream>
using namespace std;

int x = 100;

class WithStatic
{

static int x;
static int y;

public:

void print() const
{

cout << "WithStatic::x = " << x << endl;
cout << "WithStatic::y = " << y << endl;

}

};

int WithStatic::x = 1; 

/* Assegnamento di un attributo della classe definito "static".(dopo la definizione l'attributo diviene privato)*/


int WithStatic::y = x;

/* Assegnamento di un attributo della classe definito "static" dal valore di un altro attributo.*/


/* WithStatic::x NOT ::x */

int main()
{

WithStatic ws, ws2;
ws.print();
ws2.print() ;

} ///:~