Chapter 10 Classes: A Deeper Look, part 2 东方 fdong@seu.edu.cn O 2015, SEU. All rights reserved. 1
© 2009, SEU. All rights reserved. © 2015, SEU. All rights reserved. 1 Classes: A Deeper Look, Part 2 东方 fdong@seu.edu.cn Chapter 10
OBJECTIVES o To specify const (constant)objects and const member functions o To create objects composed of other objects o To use friend functions and friend classes o To use the this pointer To create and destroy objects dynamically with operators new and delete, respectively o To use static data members and member functions o 2015, SEU. All rights reserved. 2
© 2009, SEU. All rights reserved. © 2015, SEU. All rights reserved. 2 OBJECTIVES To specify const (constant) objects and const member functions. To create objects composed of other objects. To use friend functions and friend classes. To use the this pointer. To create and destroy objects dynamically with operators new and delete, respectively. To use static data members and member functions
Topics 10.1 Introduction 10.2 const(Constant)Objects and const Member Functions o 10.3 Composition: objects as members of Classes 10. 4 friend Functions and friend classes o 10.5 Using the this Pointer 10.6 Dynamic Memory Management with Operators new and delete o 10.7 static Class Members o 10.8 Data Abstraction and Information Hiding o 2015, SEU. All rights reserved. 3
© 2009, SEU. All rights reserved. © 2015, SEU. All rights reserved. 3 Topics 10.1 Introduction 10.2 const (Constant) Objects and const Member Functions 10.3 Composition: Objects as Members of Classes 10.4 friend Functions and friend Classes 10.5 Using the this Pointer 10.6 Dynamic Memory Management with Operators new and delete 10.7 static Class Members 10.8 Data Abstraction and Information Hiding
10.1 Introduction o const对象 °类的组合 composition:一个类以其他类的对象 作为成员 °友元( friend)函数:非成员函数如何访问类的私有 成员? o this指针:所有非 static函数的隐含实参 °动态内存管理:new和 delete运算符 °静态 static类成员 o 2015, SEU. All rights reserved. 4
© 2009, SEU. All rights reserved. © 2015, SEU. All rights reserved. 4 10.1 Introduction const对象 类的组合(composition): 一个类以其他类的对象 作为成员 友元(friend)函数: 非成员函数如何访问类的私有 成员? this指针: 所有非static函数的隐含实参 动态内存管理: new和delete运算符 静态static类成员
Topics 10.1 Introduction o 10.2 const( Constant)Objects and const Member Functions 10.3 Composition: Objects as Members of Classes 10.4 friend functions and friend classes o 10.5 Using the this pointer 10.6 Dynamic Memory Management with Operators new and delete o 10.7 static Class Members o 10.8 Data Abstraction and Information Hiding o 2015, SEU. All rights reserved. 5
© 2009, SEU. All rights reserved. © 2015, SEU. All rights reserved. 5 Topics 10.1 Introduction 10.2 const (Constant) Objects and const Member Functions 10.3 Composition: Objects as Members of Classes 10.4 friend Functions and friend Classes 10.5 Using the this Pointer 10.6 Dynamic Memory Management with Operators new and delete 10.7 static Class Members 10.8 Data Abstraction and Information Hiding