#include <iostream>
using namespace std;

struct test {

	// 宣言
	static const int a = 0xAA;
	static const int b = 0xBB;

	static int c;
	static int d;

};

// 定義
const int test::a;

int test::c = 0xCC;

// 定義しない
// const int test::b;
// int test::d = 0xDD;

int main() {
	// your code goes here
	cout << hex;
	
	// 宣言も定義もされているので、どちらもOK
	cout << "static const int &a : 0x" << (int)(&test::a) << endl;
	cout << "static const int  a : 0x" << (int)(test::a) << endl << endl;
	
	// 定義がないため、実体の必要な操作はエラー
	// cout << "static const int &b : 0x" << (int)(&test::b) << endl;

	// でも名前は定数のエイリアスとして使用可能
	cout << "static const int  b : 0x" << (int)(test::b) << endl << endl;

	// 宣言も定義もされているので、どちらもOK
	cout << "static       int &c : 0x" << (int)(&test::c) << endl; 
	cout << "static       int  c : 0x" << (int)(test::c) << endl << endl;

    // 定義がないため、実体の必要な操作はエラー
	// cout << "static       int &d : 0x" << (int)(&test::d) << endl; 

	// 値の参照に実体が必要なのでエラー
	// cout << "static       int  d : 0x" << (int)(test::d) << endl << endl;

	return 0;
}
