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 -- 

posted @ 2011-01-16 06:06  love && peace  阅读(146)  评论(0编辑  收藏  举报