What happens after trying to compile this code with a class template?
template<class T>
class Object
{
public:
  Object(std::string& name, const T& value):nameVal(name), objectVal(value){};
  ~Object();
private:
  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
Cosmo
Sign Up Now
or Subscribe for future quizzes