C++ Structures: Classes


Click here to start

Table of Contents

C++ Structures: Classes


A Motivating Example

General Class Definition in C++

A Simple Class

private Access Modifier

public Access Modifier

struct versus class

What about protected?

Class Methods

Defined Methods

Inline Functions

Inline Requests

Aside: A Global Inline Function

Defining Methods Separately

A Simple Class

Explicitly Requesting Inline

Referring to Class Fields

Types of Class Methods

Accessors and Mutators

Rewritten Robot Class

Object-Oriented Idea

Static Instance Variables

Static Fields Example

Static Fields as Global Variables

The Need for Manager Functions

When Managers Called

The Default Constructor (ctor)

Example Default ctor

Destructor (dtor)

Example dtor

The Copy ctor

Example Copy ctor

Other ctors

Example ctor

A Combination ctor

Hiding the Default ctor

Example ctor

Author: Richard F Maclin

Email: rmaclin@d.umn.edu

Home Page: http://www.d.umn.edu/~rmaclin/

Download presentation source