Q2 Flashcards
In the following custom type, which member is a query?
struct Movie { char m_title[32]; const double m_price; void setTitle(const char* title); double getPrice() const; };
getPrice
Which functions are allowed to modify private data in a custom type named Foo?
Only member functions of Foo.
Which of the following is the insertion operator?
What is an empty state?
It’s a special state for an object that signals the object doesn’t contain valid data.
Which of the following is the extraction operator?
> >
For the following custom type, what is correct way to define the member function getTitle in the cpp file?
const char* TvShow::getTitle() const { /* implementation */ }
Regarding the following code
class Book { char m_title[32]; double m_price;
int getNumberOfWords(const int& page) const; };
which statement is true?
The function getNumberOfWords() cannot change the state of the object or the parameter.
What is a difference between a C++ class and a C++ struct?
Members of the class are private by default, while members of the struct are public by default.
Which object is used in C++ to read data from the keyboard?
cin