Free Online Flashcard Deck

08 Classes and Objects Free Online FlashCards

Study 08 Classes and Objects with 12 free online flashcards. Review key terms, definitions, and concepts with this interactive flashcard deck.

12 cards
01
Front

What is a C++ class?

Back

A class is a user-defined type combining data with the functions that operate on that data.

02
Front

What is an object in C++?

Back

An object is an instance of a class. It occupies storage and has a lifetime.

03
Front

What follows a class definition's closing brace?

Back

The semicolon after a class definition's closing brace is required.

04
Front

What do data members represent?

Back

Data members represent an object's state; each object has its own non-static data members.

05
Front

What is a member function?

Back

A member function is associated with a class and operates on a particular object when called with the member-access operator `.`.

06
Front

What does the implicit `this` pointer refer to?

Back

Inside a non-static member function, the implicit `this` pointer refers to the object on which the function was called.

07
Front

What does `const` promise on a member function?

Back

A `const` member function promises not to modify the object's observable state through the object on which it is called.

08
Front

What are the default access levels for `class` and `struct`?

Back

Members of a `class` are `private` by default, whereas members of a `struct` are `public` by default.

09
Front

What does a constructor do?

Back

A constructor initializes an object automatically when it is created. It has the class's name and no return type.

10
Front

What determines member-initialization order?

Back

Members are initialized in the order they are declared in the class, not the order written in the initializer list.

11
Front

What does `explicit` prevent on a constructor?

Back

`explicit` prevents unintended implicit conversions for a constructor, such as rejecting `Meters distance = 5.0;`.

12
Front

What is encapsulation?

Back

Encapsulation combines state and behavior while controlling access to state. Private data and public operations can enforce valid object states.