图书前言

为了使我国计算机的教育水平赶上国际步伐,缩小与世界计算机技术水平的差距,清华大学出版社隆重推出“现代计算机教育系列教材(英文版)——国外著名大学教授鼎力之作”。

这套教材由我国著名计算机专家金兰教授主编。金兰教授1949年毕业于清华大学电机系,后留校任教,1952年赴前苏联留学,获副博士学位。1956年回国后,金兰教授主持清华大学计算机专业的创建工作,先后担任计算机教研室主任和副系主任。1984年后,金兰教授在美国从事计算机专业教育工作,目前是美国Fresno加州大学计算机科学系终身教授。

本套教材的作者均是目前在美国等计算机发展水平较高的国家担任大学教授的专家学者,他们在世界各知名大学担任主讲教授,并且,他们也将在自己任教的学校使用这些教材。我们希望这套教材的出版能使我国的计算机教育尽快与世界计算机教育接轨。英文教材的编写将尽量考虑中国国情,使之适合中国学生学习。在出版英文教材的同时,还将组织与之相应的中文翻译版教材的出版,使那些学习中文版教材的学生也能赶上国际计算机教学的水平。

我们尝试用这种聘请国外教授编著教材的方法出版教材,旨在希望这套教材能够加速我国计算机教育水平的发展,缩小与发达国家的差距。同时,也能提高我国计算机教材的出版水平,为我国计算机教材注入更新的活力。希望这套教材能够得到我国计算机教育领域的广大师生的关注,并提供宝贵的建议。

联系方式: Email: wanghanyou@tup.tsinghua.edu.cn

联系人: 汪汉友

清华大学出版社

朱海滨

现为加拿大尼波星大学(Nipissing University)计算机与数学系助理教授,  尼波星大学学科规划委员会(Academic Planning Committee of Nipissing University)委员,湖南大学软件学院兼职教授,国际电气电子工程师学会(IEEE) 高级会员(senior member), 国际计算机器学会(ACM)会员(member),中国旅美科技学会(CAST\|USA)终身会员(life member)。

1988年和1997年分别获中国国防科技大学硕士和博士学位。曾任2003年国际电气工程师协会系统人控制论(IEEE SMC)国际会议程序委员,2004年加拿大软件工程教育年会程序委员,2004年国际电气工程师协会系统\|人\|控制论(IEEE SMC)国际会议程序委员。

曾任美国新泽西理工学院访问教授和特聘讲师,中国国防科技大学教授,国防科技大学学术(科技)委员会委员, 国防科技大学计算机系学术委员会委员, 湖南省计算机学会计算机体系结构与网络专业委员会副主任。

曾获国际并行工程会议(ISPE/CE 2004)最佳论文奖, 国际商用机器公司(IBM)Eclipse创新奖(2004),国际面向对象程序设计系统、语言及应用学术年会(OOPSLA 03)教育家奖(2004),中国国家级优秀教材二等奖一项(2002),中国国家级优秀教学成果二等奖一项(1999),中国部委级科技进步一等奖三项(1991, 1994, 1997),中国部级优秀教材二等奖一项 (1996) 。

主编教材三部,主译教材一部, 助编教材一部, 发表论文50余篇。在中、美、加三国系统讲授过20门计算机专业课程,听课学生数达900(中国300, 美国460,加拿大200)余人。

目前主要研究方向包括面向对象系统及模型,基于角色的协同工作(Role\|Based Collaboration),数据挖掘,分布式系统与软件工程,以及远程教育工具与平台。

周孟初

1983年获华东工程学院(现南京理工大学)学士学位;1986年获北京理工大学自动控制系硕士,并于同年加入兵器工业部计算机应用研究所;1987年赴美学习深造,1990年获美国伦塞利尔(Rensselaer)理工学院博士学位。1987—1990年期间,曾先后在伦塞利尔理工学院CIM制造中心,纽约州生产率与技术转让中心任助理研究员。自1990年起,在美国新泽西理工学院任助理教授、副教授及正教授等,1995年获终身教职。创办并主持了离散事件系统实验室。从事Petri网的基本理论与工程应用,计算机集成系统的建模、分析和控制机理,多重生命周期,生物信号,及传感网络等方面的研究。已经发表专著两部,主编及助编研究专著各一部,发表杂志论文60多篇,会议论文100多篇,13篇book chapters。其中在IEEE Transactions发表的长文(regular papers)有24篇。许多论文中的概念、模型、结构、方法和算法等多属首次提出,并得到学术界的承认,有的得到企业界的应用。1998年创办了IEEE Systems, Man and Cybernetics学会的离散事件系统专业委员会并担任其主席。2001年创办了IEEE Robotics and Automation学会的半导体工厂自动化专业委员会并担任其共同主席,委员会吸收了大批工业界人士,先后举办多次研讨会,并在国际一流杂志上多次组织出版了相关专业的专辑,极大地促进了相关领域的发展与工业应用。多次担任重大国际会议的总主席及程序委员会主席。担任多个国际杂志编委。主要奖项有:

作者介绍                          Object\|Oriented Programming in C++: A Project\|Based Approach                          1994年美国国家科学基金委研究创新奖;

1994年美国制造工程师协会颁发的“计算机集成制造系统大学领先奖”;

1996年新泽西理工学院院长颁发的该年度Harlen  J. Perlis 研究奖(成为该奖自成立以来最年轻的得主,记录保持至今);

2000年 Whos Who in Science and Engineering (Marquis Whos Who), 5th Edition;

2000年德国洪堡基金会的美国资深科学家洪堡研究奖;

2001年新泽西亚美文化委员会的亚裔成就奖以及中国旅美科技协会的学术成就奖;

2002年Whos Who in Engineering Education (WWEE), 2002 edition;

2003年获得IEEE Fellow(院士)称号;

2003年IEEE Systems, Man and Cybernetics Society 杰出贡献奖;

2003年中国自然科学基金海外青年学者合作研究基金奖。

现担任中科院及北京科委海外评审专家, 包括美国NSF在内的多个国家科学基金的项目评审专家。他曾应邀在中国、澳大利亚、法国、德国、意大利、日本、韩国、墨西哥及中国台湾与香港等多处做学术报告。

Dr. Haibin Zhu,as an Assistant Professor of the Department of Computer Science and Mathematics, Nipissing University, Canada, also he is an Adjunct Professor of Software College, Hunan University, China. He had been a visiting professor and a special lecturer in the College of Computing Sciences, New Jersey Institute of Technology, USA, for three years before becoming a faculty member of Nipissing University. He received his M.S. and Ph.D. degrees in computer science in 1988 and 1997 from the National University of Defense Technology (NUDT), China. He was a lecturer, an associate professor and a full professor from 1988 to 2000 at NUDT. He has published more than 50 papers, three books and one book chapter on object\|oriented programming, distributed systems, collaborative systems and computer architecture. He also translated one book from English to Chinese. He is a member of the Academic Planning Committee of Nipissing University, a senior member of IEEE, a member of ACM, a member of New York Academy, and a life member of the Chinese Association for Science and Technology, USA. He served as program committee members of the 2004 Intl Conference on Systems, Man & Cybernetics (ICSMC04), October 1013,2004, The Hague, The Netherlands, the 2004 Canadian Conference on Computer and Software Engineering Education (C3SEE04), March 2930, 2004, University of Calgary, Calgary, Alberta, Canada, and the 2003 Intl Conference on Systems, Man & Cybernetics (ICSMC03), October 58, 2003 — Hyatt Regency, Washington, D.C., USA. He is the reviewer of IEEE Transactions on Systems, Man and Cybernetics, Part A, IEEE Transactions on Systems, Man and Cybernetics, Part C, and IEEE Transactions on Educations.

Dr. Zhu is the receipt of the Best Paper Award from the 11th ISPE International Conference on Concurrent Engineering (ISPE/CE2004), the 2004 IBM Eclipse Innovation Grant Award, the Educators Fellowship of OOPSLA03, a 2nd Class Nation\|Level Award of Education Achievement for contributions to computer education from Ministry of Education of China (1997), a 2nd Class Nation\|Level Award of Excellent Textbook from the Ministry of Education of China (2002), three 1st Class Ministry\|level Research Achievement Awards from DOD of China (1997, 1994, and 1991), and a 2nd Class Excellent Textbook Award of the Ministry of Electronics Industry of China (1996). 

About the Authors                          Object\|Oriented Programming in C++: A Project\|Based Approach                          Dr. Zhu started research on object\|oriented systems in the mid 1980s and completed the first object\|oriented system in China in 1990. He has taught object\|oriented programming since 1994. About 300 graduate students in China, 460 graduate students in the United States and 200 students in Canada have attended his classes on object\|oriented programming. 

Website: http://www.nipissingu.ca/faculty/haibinz

Dr. Mengchu Zhou received the B.S. degree from Nanjing University of Science and Technology, Nanjing, China in 1983, M.S. from Beijing Institute of Technology, Beijing, China in 1986, and Ph. D. in Computer and Systems Engineering from Rensselaer Polytechnic Institute, Troy, NY in 1990. He joined the Department of Electrical and Computer Engineering at the New Jersey Institute of Technology (NJIT), Newark, NJ in 1990, and he also is currently Professor in Computer Engineering and the Director of Discrete Event Systems Laboratory. He was Assistant Engineer in the Institute for Computer Applications, Beijing, China, from 1986 to 1987. 

Dr. Zhous research interests include computer\|integrated systems, network security, Petri nets and applications, discrete event systems, object\|oriented control software, life\|cycle engineering, bio\|signaling and sensor networks. His research received support from NSF, US Army, NASA, Engineering Foundation, New Jersey Commission on Science and Technology, and private industry. He co\|authored Petri Net Synthesis for Discrete Event Control of Manufacturing Systems in 1993 (with F. DiCesare), edited Petri Nets in Flexible and Agile Automation in 1995, both by Kluwer Academic, Norwell, MA, and co\|authored Modeling, Simulation, and Control of Flexible Manufacturing Systems: A Petri Net Approach, World Scientific, Singapore in 1998 (with K. Venkatesh). In addition, he has more than 200 publications including 60 journal articles, 13 book chapters, and many conference proceeding papers in his research areas. 

Dr. Zhou has organized and chaired over seventy technical sessions and tutorials/workshops and served on program committees for many international conferences. He served as the Program Chair of the 9th International Conference on CAD/CAM, Robotics, and Factories of the Future, August 1993, 1997 IEEE International Conference on Emerging Technologies and Factory Automation, and 1998 and 2001 IEEE International Conference on Systems, Man and Cybernetics. He was General Co\|Chair of 2003 IEEE International Conference on Systems, Man and Cybernetics and IEEE International Conference on Networking, Sensing and Control. He is serving or served as an Associate Editor of IEEE Transactions on Robotics and Automation, IEEE Transactions on Systems, Man and Cybernetics, and IEEE Transactions on Automation Science and Engineering, Editor of International Journal of Intelligent Control and Systems, and guest\|editors of several other journals. He was the recipient of NSFs Research Initiation Award, and was listed in 1994 Computer Integrated Manufacturing University\|LEAD Award by Society of Manufacturing Engineers, 2000 Whos Who in Science and Engineering (Marquis Whos Who), 5th Edition, and Whos Who in Engineering Education (WWEE), 2002 edition. He was granted 1996 H. J. Perlis Research Award by NJIT, 2000 Leadership Award by the Chinese Association for Science and Technology\|USA, 2000 Humboldt Research Award for Senior US Scientists, 2001 Asian American Achievement Award by Asian\|American Heritage Council, and 2003 Outstanding Contribution Award from IEEE Systems, Man and Cybernetics Society. 

Dr. Zhou is the founding Chair of IEEE Systems, Man and Cybernetics Society Technical Committee on Discrete Event Systems and an elected Administrative Committee member of IEEE Systems, Man and Cybernetics Society, and a founding co\|chair of IEEE Robotics and Automation Society Technical Committee on Semiconductor Factory Automation. He served as the 1999 President of the Chinese Association for Science and Technology\|USA. He is Fellow of IEEE.

Website: http://www.njit.edu/~zhou

This book is written for those students who want to make object\|oriented programs with C++. It arranges the contents by using “methodology first, language second” to prevent students from making non\|object\|oriented programs in C++. It also introduces the methodology via easy\|to\|understand ideas from our daily life. After the fundamental principles have been discussed completely, it introduces C++ mechanisms when they are required to do real practical projects with a step\|by\|step method. Another feature of this book is that it emphasizes the differences between object\|oriented and non\|object\|oriented mechanisms in C++ and highlights the possible problems brought in by using some C++ specific features such as friend, multiple inheritance and templates. 

This text intends to be a text for advanced programming courses and also intends to be used for a course of programming for engineering students. It will help readers to master object\|oriented programming in C++ in an easy and efficient way. This book is not only a textbook but also a book that will help the students who have little or no access to instructors or professors when they enroll a distance\|learning course. 

For a beginner without any knowledge in either C or C++, a C++ programmers manual at hand will be helpful. The prerequisites for this book include basic knowledge of C or C++, the basic ideas of programming, and data structures.

Although this text targets to the senior or graduate students of Computer Science, it introduces principles and concepts with daily life examples which is welcome by mature students of different majors. Therefore, it can also be well used by those engineering students who just have one course relevant to programming. This text is also a good reference to programmers and software engineers.

Why did we write this book?

We thoroughly explored the reasons before we decided to begin. There were several challenges at the beginning. First, we have about 20 books on our desk about object\|oriented programming and C++ programming. Most of the books are very good. Second, we have many courses to teach and a limited time to write this text. However, we started at last. 

 The first motivation comes from the encouragement of the students who took our classes. They said they really learned how to use C++ to make an object\|oriented program by attending our lectures and doing the projects we assigned. 

 The second motivation is that we really have many novel ideas for teaching and research in object\|oriented programming which were accumulated over our ten\|year experience in C++ teaching, research and applications. 

 The third one is that we find that many students may obtain good grades on examinations, but when they are asked to make a practical program, they do not even know where to start. It is our hope that this book is the last book the students will need before they begin practical object\|oriented C++ programs.

 The last motivation is that no book on our desk has the structure and the motivation to help students learn in distance. These distance\|learning students obtain no or little face\|to\|face help from instructors. For this kind of distance\|learning classes, it is difficult to evaluate students by ordinary examinations. Without reasonable and well\|designed projects, students cannot be successful in distance\|learning. 

We believe that it is impossible for one to master an object\|oriented programming language only by learning its basic structures and syntax and without applying them to real\|life projects. Therefore, we have imagined a book to guide students solving a practical problem when they are learning an object\|oriented programming language.

Preface                          Object\|Oriented Programming in C++: A Project\|Based Approach                          The Audience

This book intends to be a text for advanced programming courses and also intends to be used for programming courses for engineering students. There are a lot of requirements from engineering students who want to learn object\|oriented programming with C++. These students are different from the students of computer science. They have taken many engineering courses but few computer science courses. Object\|oriented programming courses based on our text might be their only programming course. Our text is very good at introducing object\|oriented programming to these kinds of students. 

This text is for students who want to solve real practical problems by developing object\|oriented C++ programs. It will help readers go from a novice to the next level. We hope that this book is not just a textbook, but also a book that will help students who have little or no access to instructors or professors in a distance\|learning course. 

For a beginner without any knowledge in either C or C++, a C++ programmers manual at hand will be helpful. The prerequisites for this book include basic knowledge of C or C++, the basic ideas of programming and data structures.

Although our text targets to the senior or graduate students of Computer Science, we paid more attention to the introduction of principles and concepts with daily life examples which is welcome by mature students of different majors. Therefore, our text is more relevant to those students of engineering who may have one course relevant to programming such as Electrical Engineering and Industrial Engineering. Other texts are not intended to be used by engineering students but computer science students. 

Tutorial Innovations

1. Discuss the methodology first and the language second.

In the first part, we emphasize methodology and ideas. After the object\|oriented methodology is completely discussed, in the second part we discuss C++ programming by doing projects. We believe that understanding the methodology first is essential for students to make real object\|oriented programs in C++.

This book supports a true combination of theory and practice. 

 2. Introduce the methodology via easy\|to\|understand ideas in life.

In the introduction to basic principles, we use simple and ordinary examples to discuss the basic ideas, concepts and principles of object\|orientation. This approach makes it easy for students to accept and master the principles.

3. Introduce C++ mechanisms when they are required to do real practical projects.

We use a step\|by\|step method to introduce C++ mechanisms to complete a practical real project. This learning style enables students to master C++, because everything we discuss is exactly what is needed to complete the relevant projects.

In the second part, in each chapter we provide an error\|free C++ source program that helps students get rid of the fear to compile and run a program. 

4. Emphasize the differences between object\|oriented and non\|object\|oriented mechanisms in C++.

C++ is a “hybrid” language, i.e., it supports both object\|oriented and non\|object\|oriented programming. A novice may tend to make a non\|object\|oriented program with C++. We emphasize the differences between OO and non\|OO features of C++. We also highlight the possible problems brought in by using some C++ specific features such as friend, multiple inheritance and templates. This emphasis will avoid making a non\|object\|oriented program with a so\|called object\|oriented programming language like C++.

5. Use standard C++ features. The programs discussed in this book use no special features of any specific C++ compilers. Learning C++ with this book requires no specialized compiler. In other words, any C++ compiler should serve the purpose.

Project Packages

Throughout the text, concepts and programming constructs are amply illustrated with examples of practical importance. The package is organized by chapters. All the programs are checked and debugged with Visual C++ 6.0 and without any bugs. 

Lecture Notes

The lecture notes formatted in Microsoft PowerPoint Slides are put on the website http://www.nipissingu.ca/faculty/haibinz. 

Contact the Authors

Any comments or suggestions are welcome to us by email.

Dr. Haibin Zhu: haibinz@nipissingu.ca

Dr. Mengchu Zhou: zhou@njit.edu

Acknowledgement

This book is evolved from the lecture notes used in the New Jersey Institute of Technology (NJIT) during 1999—2002. Special thanks go to the hundreds of students at NJIT who enrolled our classes of Object\|Oriented Programming.

We would like to thank Professor Tingjing Wang, the editor\|in\|chief of Tsinghua University Press, China and Professor Dafang Zhang, the Dean of Software College, Hunan University, China, for their creative planning and instant messages to propose this book publication.  

Our special thanks are also to Daniel Plourde, a student of the Department of Computer Science and Mathematics, Nipissing University, Canada, for his dedicated proofreading of the manuscript of this book.