TITLE: every class should have these methods PROBLEM: kcline@sun132.spd.dsccc.com (Kevin Cline) Scott Meyers wrote an article for the C++ Report last year discussing which member functions should be implemented for EVERY class. He concluded that the only member function needed by every class was the destructor. RESPONSE: ellis@allegra.att.com (Margaret Ellis), 28 Nov 95 Scott Meyers writes great stuff, but I believe you are thinking of the article "What functions should all classes provide?" by Martin Carroll and me (C++Report, November-December 1994). In that article we did indeed conclude that the only member function needed by every class was the destructor. After the article was published, however, we heard from Doug Lea, who showed us a counter-example class for the destructor - that is, a class for which providing a destructor is not appropriate. In brief, suppose that the following all hold for a proposed class X: - X's user's environment will provide a garbage collector - users will not need to create objects of type X on the stack - we wish to disable manual deletion of X objects Then X should not provide a destructor. Such classes will be rare, so it is safe to say that most classes should provide a destructor (and it should usually be virtual). For a more complete discussion, see "Designing and Coding Reusable C++," Addison-Wesley, 1995. In a follow-up letter to the editor, we conclude that there is *no* member function that should be provided by every class.