essential c++ book note 4 chapter 5

chapter 5

object-oriented programming 

2 primary characteristics of object-oriented programming are Inheritance and Polymorphism

Inheritance: allows us to group classes into families of related types, allowing for the sharing of common operations and data.

Polymorphism: allows us to program these families as a unit rather than as individual classes.

the parent is called base class and child is called derived class 

 

1---in object-oriented programming, we indirectly manipulate the class objects through pointers or reference.(add or remove a derived class without the need for any modification to existing program)

void loan_check_in(LibMat &mat)   // no LibMat object in our application
{
   mat.check_in();   // mat refers to an actual object 
}

2 -- 

Reproduced in: https: //www.cnblogs.com/ggppwx/archive/2011/01/16/1936555.html

Guess you like

Origin blog.csdn.net/weixin_34252090/article/details/93871314