#include <iostream>

class Handle {
public:
  Handle(): mValue(newValue()) {};

  static const Handle kUndefHandle;
  
  int value() const { return mValue; }  // Added accessor for demonstration.

protected:
  Handle(int val): mValue(val) {};
  int mValue;
  static int mNextValue;

  static int newValue() { return mNextValue++; }
};

const Handle Handle::kUndefHandle(0);

int Handle::mNextValue = 1000;

class FakeHandle : public Handle
{
public:
	FakeHandle(int val) : Handle(val) { }
};

int main() {
	Handle bad = FakeHandle(5);
	std::cout << bad.value() << std::endl;
}