Having to modify debugged code is bad.
surface += CubeSurface(b);
elseif (b->type == CYLINDER)
surface += CylinderSurface(b);
surface += ConeSurface(b);
surface += CubeSurface(b);
elseif (b->type == CYLINDER)
surface += CylinderSurface(b);
surface += ConeVolume(b);
This is what you wanted...
This is what you pasted from getVolume...
surface += CubeSurface(b);
elseif (b->type == CYLINDER)
surface += CylinderSurface(b);
surface += CylinderSurface(b);
This is because it was 2:30 am...
surface += CubeSurface(b);
elseif (b->type == CYLINDER)
surface += CylinderSurface(b);
This is because you forgot about this routine...
If you are forced to modify debugged code, you take a chance to introduce new bugs which are really hard to find.
The compiler will happily compile the faulty code and will not help you to find those bugs.