You area assigning the value of radius to itself. When the compiler builds the object circle, it uses a memory location that already contains a value. This is known as a garbage value, and has no relevance to your program. To fix this, assign the value of r to the member variable radius in the definition of the constructor.