7:
:
7.1.
7.2.
7.3.
7.4. BitVector
7.5. ,
, :
1.
.
2. ,
-, . ,
isEqual() Screen:
if ( myScreen.isEqual(yourScreen)
)
Screen :
if ( myScreen ==
yourScreen )
new
delete.
3. ,
.
,
.
.
,
.
7.1.
. ,
,
. ,
class Word {public:
int
occurs;
char *string;
};
// explicit member initialization
Word
search = { 0, "rosebud" };
- , ++
.
, ,
,
new. ,
. , Word:
class Word {public:
Word(
char*, int = 0 );
// constructor private:
int occurs;
char
*string;
};
#include <string.h>
inline Word::Word( char *str,
int cnt ) {
string = new char [ strlen(str) + 1 ];
strcpy( string, str
);
occurs = cnt;
}
. ,
, . ,
Word char*.
int.
Word
.
#include "Word.h" // Word::Word( "rosebud", 0 )
Word
search = Word("rosebud");
// Word::Word( "sleigh", 1 )
Word *ptrAns = new
Word( "sleigh", 1 );
main() {
// shorthand constructor
notations
// Word::Word( "CitizenKane", 0 )
Word film( "CitizenKane", 0
);
// Word::Word( "Orson Welles", 0 )
Word director = "Orson
Welles";
}