Don't understand this section of code.

What does this code do?
1
2
3
4
Rectangle::Rectangle():
itsWidth(5),
itsLength(10)
{}


"Rectangle" is a class name. "Rectangle()" is a member function. "itsWidth" and "itsLength" are private member variables.

Thanks.
Last edited on
It explicitly calls the members' constructors and passes them those parameters. In this case, assuming the members are of basic types, it initializes itsWidth to 5 and itsLength to 10.
Topic archived. No new replies allowed.