Home Robotics C++ Physics II AP Physics B Electronics AP Java Astronomy Independent Study Summer Session Contests  About
                                                       

Class Member Functions Illustrated

Assumptions

 

You have a class named DonutsBox.

 

The class has a member function named isEmpty.

 

The function returns true if no donuts remain in the box and false otherwise.

 

An object of the DonutsBox class named box has been created.

 

Code

 

while(!box.IsEmpty)

  //select and eat donuts 

 

Conclusion

 

Using this approach, the detailed inspection shown on the right can be avoided.

 

CLASSES SIMPLIFY LIFE'S ACTIVITIES!