C++程序设计 (Coursera)

Offered by Peking University,
C++程序设计 (Coursera)

讲授C++语言中和面向对象有关的概念和语法,如类和对象、运算符重载、继承和多态、类模板和算法模板、标准模板库等。目标是使得学生能够用C++语言,以面向对象的方法编写可维护性、可扩充性好的,较大规模的程序,初步领会面向对象程序设计方法的优势所在。

Class Deals by MOOC List - Click here and see Coursera's Active Discounts, Deals, and Promo Codes.

本课程面向已经掌握C语言的学员。通过本课程的学习,学员将掌握C++语言中类、对象、运算符重载、继承、多态等面向对象的机制,以及模版、STL等泛型程序设计的机制,领悟面向对象程序设计方法和泛型程序设计方法的优势,具备编写较大规模的、可重用性和可扩充性俱佳的面相对象的程序之能力。
Course 3 of 7 in the 程序设计与算法 Specialization.

Syllabus

WEEK 1
快来加入我们吧!
在完成了计算导论和C程序设计两门课程之后,你是不是被编写程序中逻辑思维的过程与设计精秒的小程序解决实际生活中的问题所深深吸引?你是不是有时也会为大篇幅的程序设计中查错、复用等问题而纠结?快来加入专项课程的第三门课程《C++程序设计》中来吧,为你撑起“面向对象”的另一片天地!通过这门课程的学习,你将有能力驾驭大规模的程序开发,提升自身的编程素养,并为后续的算法、数据结构等课程的学习奠定坚实的基础!PS:我们这门课程一直处在不断地建设与优化当中,吸取了很多以往课程的经典视频,所以如果你看到视频中出现了不同课程的名字,也不要惊讶哦,因为你正在集百家所长:)

WEEK 2
从C走进C++
C++是在C语言的基础上创建的一门功能更为强大的面向对象程序设计语言。在正式开始C++程序设计学习之初,我们首先回顾C语言中的高级内容,包括函数指针、命令行参数、位运算和动态内存分配,并在此基础上对C语言进行扩充,引入了引用、const关键字和常量、内联函数和重载函数、函数缺省参数等内容,为后续的C++程序设计的学习打下基础。面向对象的程序设计更接近于真实世界,它要分析待解决的问题中,有哪些类事物,每类事物都有哪些特点,不同的事物种类之间是什么关系,事物之间如何相互作用。本模块将初步介绍面向对象的程序设计的基本内容,尤其是“类”和“对象”这两个重要概念。PS:我们这门课程一直处在不断地建设与优化当中,吸取了很多以往课程的经典视频,所以如果你看到视频中出现了不同课程的名字,也不要惊讶哦,因为你正在集百家所长:)

WEEK 3
类和对象
在对类和对象有了初步的了解后,大家已经知道类是C++中十分重要的概念,它是实现面向对象程序设计的基础。类是所有面向对象的语言的共同特征,所有面向对象的语言都提供了这种类型。本模块将进一步介绍类和对象的相关深入概念与内容,包括用于初始化的构造函数,以及复制构造函数,析构函数等。

WEEK 4
运算符重载
如果不做特殊处理的话,C++的“+”“-”“*”“/”等运算符只能用于对基本类型的常量或变量进行运算,不能用于对象之间的运算。我们希望对象之间也能用这些运算符进行运算,例如,复数之间是可以进行四则运算的,两个复数对象相加如果直接用“+”运算符完成,那不是很直观和简洁吗?本模块将介绍利用C++提供的“运算符重载”机制,赋予运算符新的功能,就能解决对象之间运算的问题。

WEEK 5
继承与派生
代码重用是提高软件开发效率的重要手段,因此C++对代码重用有很强的支持,继承与派生就是支持代码重用的机制之一。例如,要编写一个学生管理程序,必然要设计一个“学生”类,“学生”类会包含学生共有的姓名、学号等属性,但是中学生、大学生、研究生又有各自不同的属性和方法,如果为每种学生单独编写一个类会造成重复与浪费。本模块将介绍通过继承和派生机制,可以在基类的基础上派生出不同的类,从而达到代码重用的目的。

WEEK 6
多态与虚函数
多态是指同一名字的事物可以完成不同的功能,例如有几个相似而不完全相同的对象,有时人们要求在向它们发出同一个消息时,它们的反应各不相同,分别执行不同的操作。在C++中,所谓多态性是指由继承而产生的相关的不同的类,其对象对同一消息会作出不同的响应。多态性是面向对象程序设计的一个重要特征,能有效增加程序的灵活性。

WEEK 7
文件操作和模板
计算机中为了便于数据的管理和检索,引入了“文件”的概念。在程序中,要使用一个文件,先要打开,打开后才能读写,读写完后要关闭。本模块将介绍C++流类相应的成员函数来实现文件操作的功能。此外,你还将学习到如何通过编写模板进行泛型程序设计,所谓“泛型”就是算法只要实现一遍,就能适用于多种数据类型。也可以说,泛型程序设计就是大量编写模板、使用模板的程序设计。

WEEK 8
标准模板库 STL-1
本模块将介绍C++的标准模板库(Standard Template Library,STL),这是泛型程序设计最成功的应用实例。STL是一些常用数据结构(如链表、可变长数组、排序二叉树)和算法(如排序、查找)的模板的集合。有了STL,你就不必编写大多的、常用的数据结构和算法。即便不想用面向对象的程序设计方法编程,学习STL也是大有裨益的。

WEEK 9
标准模板库 STL-2
本模块将继续介绍C++的标准模板库(Standard Template Library,STL),这是泛型程序设计最成功的应用实例。STL是一些常用数据结构(如链表、可变长数组、排序二叉树)和算法(如排序、查找)的模板的集合。有了STL,你就不必编写大多的、常用的数据结构和算法。即便不想用面向对象的程序设计方法编程,学习STL也是大有裨益的。

WEEK 10
期末考试
基础Wow~ 恭喜你已顺利完成了C++课程八个模块知识点的学习,在被魔兽世界各种虐心虐神之后,有没有对于C++有着一点高屋建瓴的别样体会啊?快来最后体验一下我们的期末测试吧(这是原汁原味的北京大学该课程试题,没有任何改动)!也希望与大家相聚在专项课程的下一门《算法设计》课程中,有了C和C++两种程序语言的基础,你需要进一步提升自身的算法设计技巧,让程序跑的通,还要跑的妙!

WEEK 11
[选学] C++高级主题和C++11新特性
[选学] C++高级主题和C++11新特性: 本模块给大家介绍一些C++程序设计的进阶内容,以及最新C++11标准的部分新特性。该模块内容不属于本课程必须掌握的教学内容,但是通过了解和学习必将为你打开一扇C++学习的新门,继续探索程序设计的各种精妙与美好!

WEEK 12
结束语
每一次的结束与分离,都是为了我们下一次更好的相遇。期待与你相会在《算法基础》课程!这次的视频我们来点儿不一样的吧 ^_____^

Go to Class
MOOC List is learner-supported. When you buy through links on our site, we may earn an affiliate commission.

Related Courses

Introduction to CSS3 (Coursera) Coursera
University of Michigan

Introduction to CSS3 (Coursera)

The web today is almost unrecognizable from the early days of white pages with lists of blue links. Now, sites are designed with complex layouts, unique fonts, and customized color schemes. This course will show you the basics of Cascading Style Sheets (CSS3). The emphasis will be on learning how to write CSS rules, how to test code, and how to establish good programming habits.

Jun 15th 2026
4 Weeks
An Introduction to Interactive Programming in Python (Part 1) (Coursera) Coursera
Rice University

An Introduction to Interactive Programming in Python (Part 1) (Coursera)

This two-part course is designed to help students with very little or no computing background learn the basics of building simple interactive applications. Our language of choice, Python, is an easy-to learn, high-level computer language that is used in many of the computational courses offered on Coursera. To make learning Python easy, we have developed a new browser-based programming environment that makes developing interactive applications in Python simple.

Jun 15th 2026
5-12 Weeks
Programming for Everybody (Getting Started with Python) (Coursera) Coursera
University of Michigan

Programming for Everybody (Getting Started with Python) (Coursera)

This course aims to teach everyone the basics of programming computers using Python. We cover the basics of how one constructs a program from a series of simple instructions in Python. The course has no pre-requisites and avoids all but the simplest mathematics. Anyone with moderate computer experience should be able to master the materials in this course.

Jun 15th 2026
5-12 Weeks
Introduction à la programmation orientée objet (en Java) (Coursera) Coursera
École Polytechnique Fédérale de Lausanne

Introduction à la programmation orientée objet (en Java) (Coursera)

Ce cours introduit la programmation orientée objet (encapsulation, abstration, héritage, polymorphisme) en l'illustrant en langage Java. Il présuppose connues les bases de la programmation (variables, types, boucles, fonctions, ...). Il est conçu comme la suite du cours « Initiation à la programmation (en Java) ».

Jun 21st 2026
5-12 Weeks
Interactivity with JavaScript (Coursera) Coursera
University of Michigan

Interactivity with JavaScript (Coursera)

If you want to take your website to the next level, the ability to incorporate interactivity is a must. But adding some of these types of capabilities requires a stronger programming language than HTML5 or CSS3, and JavaScript can provide just what you need. With just a basic understanding of the language, you can create a page that will react to common events such as page loads, mouse clicks & movements, and even keyboard input.

Jun 15th 2026
4 Weeks
Programming Languages, Part B (Coursera) Coursera
University of Washington

Programming Languages, Part B (Coursera)

This course is an introduction to the basic concepts of programming languages, with a strong emphasis on functional programming. The course uses the languages ML, Racket, and Ruby as vehicles for teaching the concepts, but the real intent is to teach enough about how any language “fits together” to make you more effective programming in any language -- and in learning new ones. This course is neither particularly theoretical nor just about programming specifics -- it will give you a framework for understanding how to use language constructs effectively and how to design correct and elegant programs.

Jun 15th 2026
3 Weeks
HTML, CSS, and Javascript for Web Developers (Coursera) Coursera
Johns Hopkins University

HTML, CSS, and Javascript for Web Developers (Coursera)

Do you realize that the only functionality of a web application that the user directly interacts with is through the web page? Implement it poorly and, to the user, the server-side becomes irrelevant! Today’s user expects a lot out of the web page: it has to load fast, expose the desired service, and be comfortable to view on all devices: from a desktop computers to tablets and mobile phones. In this course, we will learn the basic tools that every web page coder needs to know. We will start from the ground up by learning how to implement modern web pages with HTML and CSS.

Jun 16th 2026
5-12 Weeks
What is a Proof? (Coursera) Coursera
University of California, San Diego,Higher School of Economics - HSE University

What is a Proof? (Coursera)

Mathematical thinking is crucial in all areas of computer science: algorithms, bioinformatics, computer graphics, data science, machine learning, etc. In this course, we will learn the most important tools used in discrete mathematics: induction, recursion, logic, invariants, examples, optimality. We will use these tools to answer typical programming questions like: How can we be certain a solution exists? Am I sure my program computes the optimal answer? Do each of these objects meet the given requirements?

Jun 15th 2026
5-12 Weeks