What happens after trying to compile this code with a class template?
template<class T>
class Object
  Object(std::string& name, const T& value):nameVal(name), objectVal(value){};
  std::string& nameVal;
  const T objectVal;

std::string new("Good");
std::string old("Bad");

Object<int> p(new, 2);
Object<int> s(old, 20);

p = s; 

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Sign Up Now
or Subscribe for future quizzes