Could someone please make me understand a line in the code?
Ive commented it

class Circle {
	protected:
  		double radius;
	public:
  		Circle(double r = 1.0) : radius(r) {} //this part is what i dont understand
  		double calVal();
};

That line is the constructor. It says to use a default value of 1.0 if nothing is passed. If something is passed, the : radius(r) sets the member variable 'radius' to the value of 'r'. This is called an 'initializer list'.

Dave

commented: Yep. :) +1

Ohh!!Got it!Thankeez!:D

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.