Consider the following code. class Ticket { static int issue…
Consider the following code. class Ticket { static int issued; int id;public: Ticket() { issued += 1; id = issued; } int getId() { return id; } static int count() { return issued; }};int Ticket::issued = 0;int nextCode() { static int code = 100; code += 5; return code;}int main() { std::cout
Read DetailsA function g has one parameter, and n is an int in the calle…
A function g has one parameter, and n is an int in the caller. Pick the way of passing that each statement describes.The call has to be written g(&n): [k1]g(n) compiles and may change n, but g(5) does not compile: [k2]The parameter is a new object holding a copy of the argument, and the function is free to change that copy: [k3]The function has to decide what to do when it is given nullptr: [k4]The best choice for a large std::vector the function only reads: no copy is made and the function cannot modify it: [k5]
Read Details