Implementing a Simple Class
Public Interface of a Class
Data Members
Member Functions
Constructors
100

A class includes Data ________ and Member ________.

Members and Functions

100

Why should an accessor function often be marked as const?

Because you dont want to modify the variable

100

Data members are ______ that hold data within a class

Variables

100

True or False: member functions are implemented inside the main() function

False

100

What is a constructor used for?

Initializes the data members of an object

200

What does every class begin with?

class

200

Which function is declared in the public section and allows reading the value of a private member?

Accessor function

200

Can data members be used outside the class? Why or why not?

No, they can not because they are private

200

If a class name is Person, and it has a member function displayInfo, the correct function header should be...

void Person::displayInfo

200

What does the constructor name have to be the same as?

The class name

300

True or False? You can name a class any name you prefer.

True

300

A function that does not modify any member variables should be marked as

const

300

Can you initialize a private data member outside the class definition?

No

300

Where should member functions be implemented?

Outside the class definition

300

Are constructors declared inside or outside of the class?

Inside

400

A class is a _______________ for creating objects.

Blueprint

400

A _____ function allows changing the value of a private data member.

Mutator

400

How can data members be accessed?

Using dot notation

400

Which operator is used to implement a member function outside the class?

::

400

What does a default constructor consist of?

No arguments/parameters

500

What is always at the end of every class, indicating the end of the class?

;

500

What is the purpose of a public interface in a class?

Encapsulation

500

Where are data members declared (Private or Public)?

In private

500

When defining an _____ member function, use “const” following the parameter’s parenthesis:

Accessor  

500

Do constructors have a return type (including void)?

No!!!

M
e
n
u