Ïðîãðàììèðîâàíèå >>  Ðàñøèðåííàÿ âåðñèÿ ÿçûêà c++ 

1 ... 221 222 223 [ 224 ] 225 226 227


Ñîäåðæàíèå

ÂÂÅÄÅÍÈÅ

ÎÒËÈ×Èß ÒÐÅÒÜÅÃÎ ÈÇÄÀÍÈß..............................................................................6

Åñëè âû ÐÀÁÎÒÀÅÒÅ ïîä WINDOWS...................................................................6

ÊÀÊ ÎÐÃÀÍÈÇÎÂÀÍÀ ÝÒÀ ÊÍÈÃÀ.........................................................................7

ÈÑÕÎÄÍÛÅ ÊÎÄÛ ÏÐÎÃÐÀÌÌ.............................................................................7

ÃËÀÂÀ 1. ÊÐÀÒÊÈÉ ÎÁÇÎÐ C++..............................................................9

1.1. ×ÒÎ ÒÀÊÎÅ ÎÁÚÅÊÒÍÎ-ÎÐÈÅÍÒÈÐÎÂÀÍÍÎÅ ÏÐÎÃÐÀÌÌÈÐÎÂÀÍÈÅ?.........10

Èíêàïñóëÿöèÿ................................................................................................11

Ïîëèìîðôèçì.................................................................................................12

Íàñëåäîâàíèå.................................................................................................13

1.2. ÄÂÅ ÂÅÐÑÈÈ C++........................................................................................14

Íîâûå çàãîëîâêè â ïðîãðàììàõ íà C++.....................................................16

Ïðîñòðàíñòâà èìåí........................................................................................18

Åñëè âû ðàáîòàåòå ñî ñòàðûì êîìïèëÿòîðîì.............................................18

1.3. Êîíñîëüíûé ââîä è âûâîä â C++........................................................19

1.4. ÊÎÌÌÅÍÒÀÐÈÈ â C++...............................................................................24

11 ÍËÀÒoÐSOÅËÈÍÈÊÎÌÛKOBcèC++:==

1.7. ÂÂÅÄÅÍÈÅ â ÏÅÐÅÃÐÓÇÊÓ ÔÓÍÊÖÈÉ..........................................................36

1.8. ÊËÞ×ÅÂÛÅ ÑËÎÂÀ C++..............................................................................41

ÃËÀÂÀ 2 ÂÄÅÍÈÅ Â ÊËÀÑÑÛ..........................................................43

2.1. ÊÎÍÑÒÐÓÊÒÎÐÛ È ÄÅÑÒÐÓÊÒÎÐÛ...............................................................44

2.2. ÊÎÍÑÒÐÓÊÒÎÐÛ Ñ ÏÀÐÀÌÅÒÐÀÌÈ..............................................................51

21âÊÀäåíÅËÈÒÊÆíèÅäÈÍ:Í:ß::::::1......:=::.....65

2.5. ññû, ÑÒÐÓÊÒÓÐÛ è ÎÁÚÅÄÈÍÅÍÈß....................................................65

2:6:ââÑÒÐðàèâÀåìÛ1åå ôôóííÊÖÈèÈãîáúÿÂëåíèè-êëàññà:;;;;:::::.:=,-

ÃËÀÂÀ 3. ÏÎÄÐÎÁÍÎÅ ÈÇÓ×ÅÍÈÅ ÊËÀÑÑÎÂ....................................81

3.1. ÏÐÈÑÂÀÈÂÀÍÈÅ ÎÁÚÅÊÒÎÂ.........................................................................82

3:2:ÎÏÁòÀüÃââÎÍÊÐÂÅìÎÃÎÇíÀ×ÅÍÈßÔÓÍÊÖèé.;;:::;:

3.4. ÄÐÓÆÅÑÒÂÅÍÍÛÅ ÔÓÍÊÖÈÈ:îÁçÎÐ................................... .....................97

ÃËÀÂÀ 4. ÌÀÑÑÈÂÛ, ÓÊÀÇÀÒÅËÈ È ÑÑ1ËÊÈ..................................107

4.1. ÌÀÑÑÈÂÛ ÎÁÚÅÊÒÎÂ................................................................................108

4.2. ÈÑÏÎËÜÇÎÂÀÍÈÅ ÓÊÀÇÀÒÅËÅÉ ÍÀ ÎÁÚÅÊÒÛ.................113



(Sao Ñàìîó÷èòåëü C++

4.3. ÓÊÀÇÀÒÅËÜ THIS.........................................................................................114

If äîîïïå0àÍîèÒûÅëÜÍÛåè cDâELEÅíEèÿoÁ.oÏÅpÀòopÀxlEWèDELETE;:::::::::118

4.6. Ññûëêè....................................................................................................127

4.7. ÏÅÐÅÄÀ×À ññûëîê ÍÀ ÎÁÚÅÊÒÛ..............................................................132

4.8. ÑÑÛËÊÀ  ÊÀ×ÅÑÒÂÅ ÂÎÇÂÐÀÙÀÅÌÎÃÎ ÇÍÀ×ÅÍÈß ÔÓÍÊÖÈÈ...............135

4.9. ÍÅÇÀÂÈÑÈÌÛÅ ññûëêè è ÎÃÐÀÍÈ×ÅÍÈß ÍÀ ÏÐÈÌÅÍÅÍÈÅ ññûëîê............................................................................................................139

ÃËÀÂÀ 5. ÏÅÐÅÃÐÓÇÊÀ ÔÓÍÊÖÈÉ.......................................................143

5.1. ÏÅÐÅÃÐÓÇÊÀ ÊÎÍÑÒÐÓÊÒÎÐÎÂ..................................................................144

5.2. ÑÎÇÄÀÍÈÅ è ÈÑÏÎËÜÇÎÂÀÍÈÅ ÊÎÍÑÒÐÓÊÒÎÐÎÂ êîïèé.......................149

5.3. ÓÑÒÀÐÅÂØÅÅ ÊËÞ×ÅÂÎÅ ñëîâî OVERLOAD..............................................157

5.4. ÀÐÃÓÌÅÍÒÛ ïî ÓÌÎË×ÀÍÈÞ...................................................................158

5.5. ÏÅÐÅÃÐÓÇÊÀ è ÍÅÎÄÍÎÇÍÀ×ÍÎÑÒÜ..........................................................165

5.6. ÎÏÐÅÄÅËÅÍÈÅ ÀÄÐÅÑÀ ÏÅÐÅÃÐÓÆÅÍÍÎÉ ÔÓÍÊÖÈÈ..............................168

ÃËÀÂÀ 6. ÂÂÅÄÅÍÈÅ Â ÏÅÐÅÃÐÓÇÊÓ ÎÏÅÐÀÒÎÐÎÂ..........................175

6.1. ÎÑÍÎÂÛ ÏÅÐÅÃÐÓÇÊÈ ÎÏÅÐÀÒÎÐÎÂ.........................................................176

6.2. ÏÅÐÅÃÐÓÇÊÀ ÁÈÍÀÐÍÛÕ ÎÏÅÐÀÒÎÐÎÂ......................................................178

6.3. ÏÅÐÅÃÐÓÇÊÀ ÎÏÅÐÀÒÎÐΠÎÒÍÎØÅÍÈß è ËÎÃÈ×ÅÑÊÈÅ òîðîâ., 185

6.4. ÏÅÐÅÃÐÓÇÊÀ ÓÍÀÐÍÛÕ ÎÏÅÐÀÒÎÐÎÂ........................................................186

6.5. ÄÐÓÆÅÑÒÂÅÍÍÛÅ ÎÏÅÐÀÒÎÐ-ÔÓÍÊÖÈÈ..................................................189

6.6. ÎÑÎÁÅÍÍÎÑÒÈ ÈÑÏÎËÜÇÎÂÀÍÈß ÎÏÅÐÀÒÎÐÀ ÏÐÈÑÂÀÈÂÀÍÈß.............194

6.7. ÏÅÐÅÃÐÓÇÊÀ ÎÏÅÐÀÒÎÐÀ ÈÍÄÅÊÑÀ ÌÀÑÑÈÂÀ [}.....................................197

ÃËÀÂÀ 7. ÍÀÑËÅÄÎÂÀÍÈÅ...................................................................205

7.1. ÓÏÐÀÂËÅÍÈÅ ÄÎÑÒÓÏÎÌ ê ÁÀÇÎÂÎÌÓ ÊËÀÑÑÓ......................................207

7.2. ÇÀÙÈÙÅÍÍÛÅ ×ËÅÍÛ ÊËÀÑÑÀ...............................................................212

7.3. ÊÎÍÑÒÐÓÊÒÎÐÛ, ÄÅÑÒÐÓÊÒÎÐÛ È ÍÀÑËÅÄÎÂÀÍÈÅ...............................216

7.4. ÌÍÎÆÅÑÒÂÅÍÍÎÅ ÍÀÑËÅÄÎÂÀÍÈÅ......... ..............................................223

7.5. ÂÈÐÒÓÀËÜÍÛÅ ÁÀÇÎÂÛÅ ÊËÀÑÑÛ.............................................................229

ÃËÀÂÀ 8. ÂÂÅÄÅÍÈÅ Â ÑÈÑÒÅÌÓ ÂÂÎÄÀ/ÂÛÂÎÄÀ C++..................239

8.1. ÍÅÊÎÒÎÐÛÅ ÁÀÇÎÂÛÅ ÏÎËÎÆÅÍÈß ÑÈÑÒÅÌÛ ÂÂÎÄÀ/ÂÛÂÎÄÀ Ñ++.... 242

8.2. ÔÎÐÌÀÒÈÐÓÅÌÛÉ ââîä/âûâîä............................ ......... .............244

8.3. ÔÓÍÊÖÈÈ REcisiONQ L()..............................................251

8.4. ÌÀÍÈÏÓËßÒÎÐÛ ÂÂÎÄÀ/ÂÛÂÎÄÀ............................................................254

8.5. ÏÎËÜÇÎÂÀÒÅËÜÑÊÈÅ ÔÓÍÊÖÈÈ ÂÛÂÎÄÀ................................................259

8.6. ÏÎËÜÇÎÂÀÒÅËÜÑÊÈÅ ÔÓÍÊÖÈÈ ÂÂÎÄÀ...................................................265

ÃËÀÂÀ 9. ÄÎÏÎËÍÈÒÅËÜÍÛÅ ÂÎÇÌÎÆÍÎÑÒÈ

ÂÂÎÄÀ/ÂÛÂÎÄÀ Â C++.........................................................................271

9.1. ÑÎÇÄÀÍÈÅ ÏÎËÜÇÎÂÀÒÅËÜÑÊÈÕ ÌÀÍÈÏÓËßÒÎÐÎÂ................................272

9.2. ÎÑÍÎÂÛ ÔÀÉËÎÂÎÃÎ ÂÂÎÄÀ/ÂÛÂÎÄÀ.....................................................275



Ñîäåðæàíèå 681

9.3. ÍÅÔÎÐÌÀÒÈÐÓÅÌÛÉ äâîè÷íûé ââîä/âûâîä.....................................282

9.4. ÄÎÏÎËÍÈÒÅËÜÍÀß ÈÍÔÎÐÌÀÖÈß î ÔÓÍÊÖÈßÕ äâîè÷íîãî ÂÂÎÄÀ/ÂÛÂÎÄÀ................................................................................................288

9.5. ÏÐÎÈÇÂÎËÜÍÛÉ ÄÎÑÒÓÏ..........................................................................292

9.6. ÊÎÍÒÐÎËÜ ÑÎÑÒÎßÍÈß ÂÂÎÄÀ/ÂÛÂÎÄÀ ............................................295

9.7. ÏÎËÜÇÎÂÀÒÅËÜÑÊÈÅ âûâîä è ÔÀÉËÛ.........................................298

ÃËÀÂÀ 10. ÂÈÐÒÓÀËÜÍÛÅ ÔÓÍÊÖÈÈ...............................................303

10.1. ÓÊÀÇÀÒÅËÈ ÍÀ ÏÐÎÈÇÂÎÄÍÛÅ ÊËÀÑÑÛ................................................304

10.2. ÇÍÀÊÎÌÑÒÂÎ ñ ÂÈÐÒÓÀËÜÍÛÌÈ ÔÓÍÊÖÈßÌÈ.....................................306

10.3. ÄÎÏÎËÍÈÒÅËÜÍÛÅ ÑÂÅÄÅÍÈß î ÂÈÐÒÓÀËÜÍÛÕ ÔÓÍÊÖÈßÕ..............313

10.4. ÏÐÈÌÅÍÅÍÈÅ ÏÎËÈÌÎÐÔÈÇÌÀ............................................................317

ÃËÀÂÀ 11. ØÀÁËÎÍÛ È ÎÁÐÀÁÎÒÊÀ ÈÑÊËÞ×ÈÒÅËÜÍÛÕ ÑÈÒÓÀÖÈÉ...........................................................................................325

11.1. ÐÎÄÎÂÛÅ ÔÓÍÊÖÈÈ................................................................................326

ÑÈÒÓÀÖÈÉ....................................... ................................................................344

11.5. ÎÁÐÀÁÎÒÊÀ ÈÑÊËÞ×ÈÒÅËÜÍÛÕ ÑÈÒÓÀÖÈÉ, ÂÎÇÁÓÆÄÀÅÌÛÕ ÎÏÅÐÀÒÎÐÎÌ NEW.............................................................................................351

ÃËÀÂÀ 12. ÄÈÍÀÌÈ×ÅÑÊÀß ÈÄÅÍÒÈÔÈÊÀÖÈß

È ÏÐÈÂÅÄÅÍÈÅ ÒÈÏÎÂ......................................................... .......357

12.1. ÏÎÍßÒÈÅ Î ÄÈÍÀÌÈ×ÅÑÊÎÉ ÈÄÅÍÒÈÔÈÊÀÖÈÈ ÒÈÏÀ.......................358

ÃËÀÂÀ 13. ÏÐÎÑÒÐÀÍÑÒÂÀ ÈÌÅÍ È ÄÐÓÃÈÅ ÒÅÌÛ.......................383

131:ÔÓÍÊÖÈÈñÏÐÅîèÐÀÛ0âÀíèå:::::::::..............;==::::14

13i:COSS ÷ëìÄÈôêÈÖñÈÐÓåìÛå.÷ëåíû--êëàññà:-,-,-,-,-:::

13.5. ÇÀÊËÞ×ÈÒÅËÜÍÛÉ ÎÁÇÎÐÖÊÎóÑÒÐÓÊÒÎÐÎÂ..........................................404

13.6. ÑÏÅÖÈÔÈÊÀÒÎÐÛ ÑÁÎÐÊÈ è ÊËÞ×ÅÂÎÅ ñëîâî ASM...........................408

13.7. ÌÀÑÑÈÂÛ Â ÊÀ×ÅÑÒÂÅ ÎÁÚÅÊÒΠÂÂ0ÄÀ/ÂÁ1Â0ÄÀ..............................411

ÃËÀÂÀ 14. ÁÈÁËÈÎÒÅÊÀ ÑÒÀÍÄÀÐÒÍÛÕ ØÀÁËÎÍÎÂ.....................419

14.1. ÇÍÀÊÎÌÑÒÂÎ ñ ÁÈÁËÈÎÒÅÊÎÉ ÑÒÀÍÄÀÐÒÍÛÕ ØÀÁËÎÍÎÂ..................421

14.2. ÊËÀÑÑÛ-ÊÎÍÒÅÉÍÅÐÛ............................................................................424

14.3. ÂÅÊÒÎÐÛ..................................................................................................425

1.ÑïèÎêèÀÒèâÍÛÅñïèñêè;........z.....::::::::::::=:=446

14:6:ÀËÃ0 êëàññ:ã:7:-:::::::::



1 ... 221 222 223 [ 224 ] 225 226 227

© 2006 - 2024 pmbk.ru. Ãåíåðàöèÿ ñòðàíèöû: 0
Ïðè êîïèðîâàíèè ìàòåðèàëîâ ïðèâåòñòâóþòñÿ ññûëêè.
ßíäåêñ.Ìåòðèêà