The simplified version of the code
public double Width
{
get
{
return pri_width;
}
set
{
if(value < 0)
{
pri_width = -value;
}
else
{
pri_width = value;
}
}
}
Read ternary operator to unserstadn original code.
if you dont understand properties:
public double GetWidth
{
return pri_width;
}
public void setWidth(double value)
{
if(value < 0)
{
pri_width = -value;
}
else
{
pri_width = value;
}
}
Discaimer: solution provided by JF2015 is the best one. I am just explaining the original code.