MOD 2_ZYBOOKS 3_STRUCTS & CLASSES Flashcards
(116 cards)
What is an object?
A grouping of data (variables) and operations that can be performed on that data (functions).
What is abstraction? (aka information hiding or encapsulation).
To have a user interact with an item at a high-level, with lower-level internal details hidden from the user
What is an abstract data type (ADT)? What can be used to implement it?
A data type whose creation and update are constrained to specific well-defined operations. A class can be used to implement an ADT.
What does a namespace do? Which operator does it use?
Defines a region (or scope) used to prevent name conflicts.
The scope resolution operator :: allows specifying in which namespace to find a name, as in: auditorium::Seat concertSeat; and airplane::Seat flightSeat;.
T/F: Are all items in the C++ standard library part of the std namespace?
True.
What are the 2 ways in which a programmer can use classes like string or predefined objects like cout?
T/F: For code clarity, most programming guidelines discourage using namespace directives except perhaps for std.
True.
What is an inline member function?
A member function’s definition that appears within the class definition.
What does an inline member function look like?
Normally, items like variables must be declared before being used, but this rule does not apply within a ________?
Class definition.
T/F: A public inline member function can thus access a private data member even though that private data member is declared after the function.
True.
Should a very short inline member’s function statements be put below the function’s name or on one line?
What is an ostream (output stream)?
A class that supports output, available via #include <iostream> and in namespace "std".</iostream>
What operator does an ostream use?
The insertion operator («)
What does an insertion operator («) do?
Converts different types of data into a sequence of characters.
That sequence is normally placed into a buffer, and the system then outputs the buffer at various times.
(«) operators can appear in series.
What data types can the «_space;operator support?
Standard data types, such as int, bool, float, etc.
What is cout?
A predefined ostream object (declared as ostream cout; in the iostream library) that is pre-associated with a system’s standard output, usually a computer screen.
What is an istream (input stream)?
A class that supports input. Available via #include <iostream></iostream>
What is the (») operator?
Extraction operator.
Extracts data from a data buffer and writes the data into different types of variables.
What is cin?
A predefined istream pre-associated with a system’s standard input, usually a computer keyboard.
The system automatically puts the standard input into a data buffer associated with cin.
The (») operator skips leading ________ and reads characters up to the next ________.
Whitespace, whitespace
What is a class?
The class definition creates a new type that can group data and functions to form an object.
What are a class’ public member functions?
They indicate all operations a class user can perform on the object.
Does a class user need not know how the class’ data and functions are implemented?
No. They need only understand how each public member function behaves.