Question.5
A UART driver disables copying:
class UART { public: UART(int baud) { /* claim hardware */ } UART(const UART&) = delete; // No copying }; UART u1(9600); UART u2 = u1; // Attempt to copy
Will UART u2 = u1 compile?
UART u2 = u1
Select Answer
Yes -- the compiler generates a default copy
No -- the copy constructor is deleted; attempting to copy is a compilation error
Yes -- but u2 shares the same hardware as u1
No -- but using std::move would work