Also the resize method would have to look similar to the first one, I messed that up, it should be: void resize(Size size) { if (size.width) this.width = size.width; if (size.height) this.height = size.height; }