I’m following this tutorial, which has been fine up until chapter 3.
I’m getting errors when I try to set x and y of object home to anything, and also when I call Translate or set description.
public class Point
{
public int x;
public int y;
public Point(int ix, int iy)
{
x = ix;
y = iy;
}
public void Translate(int dx, int dy)
{
x += dx;
y += dy;
}
Point p = new Point(2, 3);
p.Translate(1, 1);
}
Unexpected symbol ‘(’ in class, struct or interface member declaration - when I try to ‘translate’
public class Location : Point
{
public string description = "";
Location home = new Location();
home.description = "Home";
home.x = 0;
home.y = 0;
}
Unexpected symbol ‘=’ in class, struct or interface member declaration
how can I set/change the variables of an object…