[Cpp] <span style = "font-size: 18px; "> </span> // ==================================== ========================================================== =====// Name: 11.cpp// Author: zhaoming // Version: // Copyright: copyright to zhaoming // Description: Hello World in C ++, ansi-style // ========================================== ========================================================== = # include <iostream> using namespace std; class INTSET; // incomplete declaration or Forward Declaration clas S REALSET {float * elems; int card, maxcard; public: REALSET (INTSET & s );~ REALSET () {delete elems ;}}; class INTSET {int * elems, card, maxcard; // note: the member functions of another class cannot be defined within one class, however, it can be declared that * friend double REALSET: REALSET (INTSET & s) is written in the/** textbook as follows) // automatically becomes the inline function {// after this function is declared as an INTSET member, you can directly access the INTSET member elems = new float [maxcard = s. maxcard]; card = s. card; for (int I = 0; I <card; I ++) {elems [I] = s. elems [I] ;}} */friend REALSET: REALSET (INTSET & s); // automatically becomes the inline function public: INTSET (int maxcard );~ INTSET () {delete elems;} int getcard () {return card;} int getelems (int I) {return elems [I] ;}; REALSET :: REALSET (INTSET & s) {// after this function is declared as a friend of INTSET, you can directly access the elems = new float [maxcard = s. maxcard]; card = s. card; for (int I = 0; I <card; I ++) {elems [I] = s. elems [I] ;}} INTSET: INTSET (int max) {elems = new int [maxcard = max]; card = 0;} int main () {INTSET iset (20); REALSET rset (iset );}