Sams Teach Yourself C++ in 21 Days
88: PartNode * itsNext; 89: }; 90: // PartNode Implementations... 91: 92: PartNode::PartNode(Part* pPart): 93: itsPart(pPart), 9 ...
Advanced Inheritance 557 16 138: private: 139: PartNode * pHead; 140: int itsCount; 141: static PartsList GlobalPartsList; 142: ...
190: if (pNode->GetPart()->GetPartNumber() == PartNumber) 191: break; 192: } 193: if (pNode == NULL) 194: return NULL; 195 ...
Advanced Inheritance 559 16 240: return; 241: } 242: 243: // if this goes after this one and before the next 244: // then insert ...
292: int PartsCatalog::Exists(int PartNumber) 293: { 294: int offset; 295: thePartsList.Find(offset,PartNumber); 296: return off ...
Advanced Inheritance 561 16 (0)Quit (1)Car (2)Plane: 1 New PartNumber?: 1234 Model Year?: 94 (0)Quit (1)Car (2)Plane: 1 New Part ...
On line 274, this value is fed to the PartsList’s Find()method, and if no match is found, the number is inserted (line 276); oth ...
Advanced Inheritance 563 16 implemented in terms of a PartsList, just as would have been the case with aggrega- tion. The privat ...
43: }; 44: 45: CarPart::CarPart(int year, int partNumber): 46: itsModelYear(year), 47: Part(partNumber) 48: {} 49: 50: 51: // ** ...
Advanced Inheritance 565 16 93: {} 94: 95: PartNode::~PartNode() 96: { 97: delete itsPart; 98: itsPart = 0; 99: delete itsNext; ...
145: PartsList::PartsList(): 146: pHead(0), 147: itsCount(0) 148: {} 149: 150: PartsList::~PartsList() 151: { 152: delete pHead; ...
Advanced Inheritance 567 16 195: void PartsList::Iterate(void (Part::*func)()const) const 196: { 197: if (!pHead) 198: return; 1 ...
247: return; 248: } 249: pCurrent = pNext; 250: } 251: } 252: 253: class PartsCatalog : private PartsList 254: { 255: public: 25 ...
Advanced Inheritance 569 16 297: return (Find(offset, PartNumber)); 298: 299: } 300: 301: int main() 302: { 303: PartsCatalog pc ...
1234 was the first entry. Rejected! (0)Quit (1)Car (2)Plane: 1 New PartNumber?: 2345 Model Year?: 93 (0)Quit (1)Car (2)Plane: 0 ...
Advanced Inheritance 571 16 Adding Friend Classes .............................................................................. ...
To declare a class as a friend, you use the C++ friend keyword: class ClassOne { public: friend class BefriendedClass; ... In th ...
Advanced Inheritance 573 16 34: public: 35: CarPart():itsModelYear(94){} 36: CarPart(int year, int partNumber); 37: virtual void ...
86: private: 87: Part *itsPart; 88: PartNode * itsNext; 89: }; 90: 91: 92: PartNode::PartNode(Part* pPart): 93: itsPart(pPart), ...
Advanced Inheritance 575 16 136: } 137: private: 138: PartNode * pHead; 139: int itsCount; 140: static PartsList GlobalPartsList ...
«
25
26
27
28
29
30
31
32
33
34
»
Free download pdf