10

Classes

LEARNING OBJECTIVES

At the end of this chapter, you should be able to

  • Write C++ programs using classes and objects.

  • Understand concepts of constructors, destructors, and member data and functions.

  • Understand container classes and their usage.

  • Understand friend functions and inline functions.

  • Understand objects and dynamic memory usage with pointers and reference.

  • Understand this operator and static declarations and their usage.

10.1 Introduction

We use class in C++ to define our own data type. A class is a derived data type like an array. The difference is that in an array you have single data type, while in a class data type you can have different data types. These different data types can be intrinsic data types such as int, ...

Get Object-oriented Programming Using C++ and Java now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.