Static Variables
class start : AnglePrinter
static variable declare : private rightAlias string "right"
static variable declare : private rightAmount int 90
member function declare start : public PrintAngle string angle int
if start : { operation : angle (equal to) { static variable : private AnglePrinter rightAmount } }
return : { static variable : private AnglePrinter rightAlias }
if end
return : { string format : ("{0} degrees") angle int }
member function declare end
class endclass AnglePrinter
{
private static string rightAlias = "right";
private static int rightAmount = 90;
public string PrintAngle(int angle)
{
if (angle == AnglePrinter.rightAmount)
{
return AnglePrinter.rightAlias;
}
return string.Format("{0} degrees", angle);
}
}Last updated