13. What is the result of executing the code fragment below? // suitable #includes class Text { public: Text(const std::string &text) : data(new char[text.size() + 1000]) { std::copy(text.begin(), text.end(), data); } ~Text() { delete [] data; } void print() const { std::cout << data << std::endl; } private: char *data; }; int main(int, char *[]) { Text outer("hello"); { const Text inner("world"); outer = inner; } outer.print(); return 0; } a. prints "hello" b. prints "world", but there is a buffer overflow in the constructor c. prints "world", no problems anywhere d. none of the above 14. For some class Value, which of the following fragments is the preferred way of writing the declaration of the equality operator? a. extern bool operator==(const Value &lhs, const Value &rhs); b. class Value { public: bool operator==(const Value &other); }; c. class Value { public: bool operator==(const Value *other); }; d. class Value { public: bool operator==(const Value &other) const; }; 15. Consider the following line of code: C c1 = c2; What method is called ? a. Assignment operator b. Copy constructor c. Both d. None of the above 16. Consider the following code: struct A { int i; }; class B { int j; } a. A::i is publicly accessible b. B:i is publicly accessible c. both the above are true d. Neither the above are true
Sigiloso
#14 "preferred" by whom? #16 b. is maybe a typo?