Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 265 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
265
Dung lượng
502,56 KB
Nội dung
Programming in C++ Dr Bernd Mohr b.mohr@fz-juelich.de Forschungszentrum Jülich Germany 1997 - 2000, Dr Bernd Mohr, Forschungszentrum Jülich, ZAM Version 21 March 2000 Introduction Basics: The C part of C++ 15 Motivation 35 From C to C++ 51 Classes 81 Pointer Data Members 103 More on Classes 127 More Class Examples 175 Advanced I/O 209 Array Redesign 239 Templates 253 Programming in C++ Contents Inheritance 271 More on Arrays 305 The C++ Standard Library and Generic Programming 339 Advanced C++ 427 Object-Oriented Design 463 Class std::string 475 Appendix English – German Dictionary i Index ix Programming in C++ ✰✰✰ Introduction ✰✰✰ Dr Bernd Mohr b.mohr@fz-juelich.de Forschungszentrum Jülich Germany Programming in C++ Dr Bernd Mohr, FZ Jülich, ZAM Introduction Page Hello World ❑ Kindergarden (BASIC) 10 PRINT "Hello World" 20 END ❑ School (PASCAL) program Hello(input, output); begin writeln (’Hello World’) end ❑ University (LISP) (defun hello (print (cons ’Hello (list ’World)))) ❑ Professional (C) #include or perl -e ’print "Hello World\n"’ int main (int argc, char *argv[]) { printf ("Hello World\n"); return 0; } Programming in C++ Dr Bernd Mohr, FZ Jülich, ZAM Page ❑ Seasoned pro (C++) #include using using #include using std::cout; std::endl; std::string; int main(int argc, char *argv[]) { string str = "Hello World"; cout