运算符重载的基本概念

Loading...
Peking University
4.8 (740 ratings) | 34K Students Enrolled
View Syllabus

Reviews

4.8 (740 ratings)
  • 5 stars
    622 ratings
  • 4 stars
    82 ratings
  • 3 stars
    21 ratings
  • 2 stars
    8 ratings
  • 1 star
    7 ratings
RX

Oct 22, 2017

Excellent course! Teachers are humorous and good at logical teaching.

YZ

Aug 20, 2015

???????????????????????????????????????????????????

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

Taught By

  • Jiaying Liu 刘家瑛, Ph.D.

    Jiaying Liu 刘家瑛, Ph.D.

    Associate Professor
  • 郭 炜

    郭 炜

    讲师

Explore our Catalog

Join for free and get personalized recommendations, updates and offers.