Module 8 - Introduction to Classes and Objects

BLUF - Bottom Line Up Front

A class is a non-primitive or user-defined data type in C++, while an object is an instance of a class. A class is a collection of a fixed number of components. The components of a class are called the members of the class. For example: in real life, a car is an object. The car has attributes, such as weight and color, and methods, such as drive and brake. A Class is like an object constructor or a "blueprint" for creating objects.

 Learning Objective

  • Learn about classes

  • Learn about private, protected, and public members of a class

  • Explore how classes are implemented

  • Become aware of accessor and mutator functions

  • Examine constructors and destructors

  • Learn about information hiding

  • Explore how information hiding is implemented in C++

Module 8 introduces a structured data type called a class, which is specifically designed to group data and functions. After examining its structure, students will learn how to create and use classes. The typical members of a class will be discussed, including accessors, mutators, constructors, and destructors. We will define the properties of these members, such as private, protected, public, and static. Students will also learn about abstract data types and how classes are used to implement them. In the process, they will be introduced to the concept of information hiding. Finally, we will discuss information hiding as implemented in C++.

 

 

COSC-1336 / ITSE-1302 Computer Science - Author: Dr. Kevin Roark