Quote:
Originally Posted by xpi0t0s View Post
They could be default values. That means that you can miss off those parameters when you declare a Box and you will get the default. Example: Box a, b(1), c(1,2), d(1,2,3); will define 4 boxes of dimensions a=10,20,30; b=1,20,30; c=1,2,30; d=1,2,3 and all four will invoke the Box::Box(double l=10, double w=20, double d=30) constructor.

nitpicks:
- include the variable names in the constructor prototype. e.g double l=30.0, rather than double=30.0. It's clearer to read that way.
- you don't need the Box:: prefix on function names when the function is written within the class definition, i.e. public: Box::Box(...) should be shortened to public: Box(...). Again this is for clearer reading; you would only expect to see Box(...) and the addition of Box:: will make you wonder why that's been added.
The Box:: prefix is needed for stuff written outside the class definition, i.e.:
Code:
class foo {
  void func1(); // no prefix needed
  void func2() { /* ... */ } // no prefix needed
};
void foo::func1() { /* ... */ } // prefix is needed here to distinguish between foo::func1() and a global function func1().
void func1() { /* ... */ } // this declares a global function func1() that has nothing to do with the one in class foo
Ok thanks again for all your help with this problem. Have a great day.