How to deal with inheritance in the object-oriented model? Let's take a look at the specific description of the square class: [cpp] # ifndef _ CSQUA_H _ # define _ CSQUA_H _ # include "crect. h "/* Square Class, inherits from Rectangle, for describing square objects */class (csqua) {extends (crect);/* Inherits from crect class */}; # endif/* _ CSQUA_H _ */csqua. in h, the csqua class is inherited directly from the crect class (extends). Square is a special case of the rectangle with the same width and height. [Cpp] # include "csqua. h "static double peri (void * this) {return 4 * (crect *) this)-> width;} static double area (void * this) {return (crect *) this)-> width * (crect *) this)-> width;} constructor (csqua) {mapping (crect. imeas. peri, peri); mapping (crect. imeas. area, area);} destructor (csqua) {return 1;/* Returns 1 for freeing the memory */} csqua. note in c that width is the attribute of the rectangle, so this pointer is actually of the crect * type. So far, the OOSM macro package and a simple and complete example have been introduced. From here, we can see that object-oriented is an idea, not a language patent. Of course, because the c language is process-oriented, it cannot implement boundaries such as private, public, and protect, nor can it hide the this pointer, resulting in the form of c-> diam (c) this is not a natural way of writing, and the inheritance should not be too deep.