0) { this.color = value; } } } } // accessing: Pen pen = new Pen(); int color_tmp = 0; // ... pen.Color = 17; color_tmp = pen.Color; // ... pen.Color = ~pen.Color; // bitwise complement ... // another silly example: pen.Color += 1; // a lot clearer than "pen.set_Color(pen.get_Color() + 1)"! Recent C# versions also allow "auto-implemented properties" where the backing field for the property is generated by the compiler during compilation. This means that the property must have a setter. However, it can be private. class Shape { public int Height { get; set; } public int Width { get; private set; } } C++ C++ does not have first class properties, but there exist several ways to emulate properties to a limited degree. Two of which follow: Using Standard C++ #include <iostream> template <typename T> class property { T value; public: T & operator = (const T &i) { return value = i; } // This template class member function template serves the purpose to make // typing more strict. Assignment to this is only possible with exact identical types. // The reason why it will cause an error is temporary variable created while implicit type conversion in reference initialization. template <typename T2> T2 & operator = (const T2 &i) { T2 &guard = value; throw guard; // Never reached. } // Implicit conversion back to T. operator T const & () const { return value; } }; struct Foo { // Properties using unnamed classes. class { int value; public: int & operator = (const int &i) { return value = i; } operator int () const { return value; } } alpha; class { float value; public: float & operator = (const float &f) { return value = f; } operator float () const { return value; } } bravo; }; struct Bar { // Using the property<>-template. property <bool> alpha; property <unsigned int> bravo; }; int main () { Foo foo; foo.alpha = 5; foo.bravo = 5.132f; Bar bar; bar.alpha = true; bar.bravo = true; // This line will yield a compile time error // due to the guard template member function. ::std::cout << foo.alpha << ", " << foo.bravo << ", " << bar.alpha << ", " << bar.bravo << ::std::endl; return 0; } Also see Stack Overflow for a more detailed example. C++, Microsoft, GCC, LLVM/clang and C++Builder-specific An example taken from