TITLE: Non-const members impact derived classes PROBLEM: Thaddeus L. Olczyk In Ellis/Carroll column in the Nov-Dec 93 issue of C++-Report describing fine-grained inheritance seems to hint that there is a between the way that const and non-const member functions are treated in inheritance. I could not find such a distinction in the ARM. Can anyone help? RESPONSE: ellis@summit.novell.com (Margaret A. Ellis & Martin D. Carroll) It's not that the const and nonconst member functions are treated differently. It's that the ease with which one can inherit from a class differs depending on whether that class has nonconst member functions. Look at the example in our column again. We show that you can't create a class Clear_toothpaste by inheriting from a class Toothpaste, and have Clear_toothpaste semantically conform to its base class Toothpaste - because Toothpaste has the nonconst member function add_red_stripes. If you have the function add_red_stripes add a red stripe, then you no longer have a completely clear toothpaste; on the other hand, if you don't have Clear_toothpaste::add_red_stripes add a red stripe, then Clear_toothpaste no longer acts like a Toothpaste (and inheritance is an IS_A relationship, remember, so if Clear_toothpaste inherits from Toothpaste, then it should act like a Toothpaste). The point is: If a class defines member functions that change the abstract state of an object (nonconst member functions), that limits the classes that can be derived from that class. This is not to say that a class should never have a nonconst member function. If you know in advance that *all* classes that will ever be derived from your class will logically have the nonconst function you're thinking of putting in your base class, then go ahead and give your class the nonconst function. [ To me, the problem seems less a problem of const vs non-const than an abstraction problem. Having get/set for red stripes in the base class fixes the stripes notion as fundamental to all toothpastes. Perhaps a rereading of said article is in order? -adc ]