Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more ➡
Download
Standard view
Full view
of .
Add note
Save to My Library
Sync to mobile
Look up keyword or section
Like this
13Activity
×

Table Of Contents

0 of .
Results for:
No results containing your search query
P. 1
C and C++ in 5 days

C and C++ in 5 days

Ratings: (0)|Views: 2,796|Likes:
Published by xinuxnet
learn C and C++ in five days
learn C and C++ in five days

More info:

Published by: xinuxnet on Jan 19, 2010
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See More
See less

12/14/2012

pdf

text

original

 
C and C++ in 5 daysPhilip Machanick
Computer Science DepartmentUniversity of the Witwatersrand
2050 WitsSouth Africaphilip@concave.cs.wits.ac.za
 please contact the author for commercial use
copyright © Philip Machanick 1994
 
c o n t e n t s
Preface ......................................................................................4Part 1—Overview.......................................................................5
file structure..................................................................................................5simple program...........................................................................................5a few details.................................................................................................6
hands-on—enter the program on page 2...................................7part 2—Language Elements ......................................................8
functions.......................................................................................................8types..............................................................................................................9statements....................................................................................................10
hands-on—a larger program......................................................12part 3—Style and Idioms ...........................................................13
switch............................................................................................................13loops..............................................................................................................13arguments....................................................................................................13pointers and returning values...................................................................14arrays, pointer arithmetic and array arguments....................................14
hands-on—sorting strings..........................................................17part 4—Structured Types...........................................................19
struct..............................................................................................................19typedef..........................................................................................................19putting it together: array of struct..............................................................21
hands-on—sorting employee records........................................22part 5—Advanced Topics...........................................................23
preprocessor................................................................................................23function pointers..........................................................................................24traps and pitfalls..........................................................................................25
hands-on—generalizing a sort ..................................................27part 6—Programming in the Large.............................................28
file structure revisited.................................................................................28maintainability.............................................................................................28portability......................................................................................................29hiding the risky parts..................................................................................29performance vs. maintainability...............................................................29
hands-on—porting a program from Unix....................................31part 7—Object-Oriented Design.................................................32
identifying objects.......................................................................................32object relationships....................................................................................32entities vs. actions.......................................................................................33example: event-driven program...............................................................33
design task—simple event-driven user interface.......................34part 8—OOD and C....................................................................35
language elements.....................................................................................35example........................................................................................................35
hands-on—implementation........................................................38part 9—Object-Oriented Design and C++..................................39
OOD summary.............................................................................................39objects in C++..............................................................................................39stream I/O.....................................................................................................41
 
differences from C.......................................................................................41
hands-on—simple example .......................................................44part 10—Classes in More Detail................................................45
constructors and destructors.....................................................................45inheritance and virtual functions..............................................................46information hiding.......................................................................................46static members............................................................................................46
hands-on—adding to a class.....................................................48part 11—style and idioms..........................................................49
access functions..........................................................................................49protected vs. private...................................................................................49usage of constructors.................................................................................50
hands-on—implementing a simple design.................................52part 12—Advanced Features .....................................................53
mixing C and C++.......................................................................................53overloading operators................................................................................53memory management................................................................................54multiple inheritance....................................................................................55cloning..........................................................................................................56
hands-on—3-D array class........................................................58part 13—Design Trade-Offs.......................................................59
case study—vector class...........................................................................59defining operators vs. functions...............................................................59when to inline..............................................................................................59the temporary problem...............................................................................60
hands-on—vector class using operators ...................................61part 14—More Advanced Features and Concepts .....................62
templates......................................................................................................62exceptions....................................................................................................63virtual base classes....................................................................................63future feature: name spaces.....................................................................64libraries vs. frameworks.............................................................................64
i n d e x......................................................................................65

Activity (13)

You've already reviewed this. Edit your review.
1 hundred reads
venedik liked this
Ravi Av liked this
nikotlea liked this
eyesboxcc2 liked this
Abhinav Phapale liked this
darshanahosur liked this
Yogesh Gawali liked this

You're Reading a Free Preview

Download
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->