Having the following class definition, what will be the output of the program?
#include <iostream>

class A {};

template<class T> class B {
  int i;
public:
  int func(B<A>& c) {
    c.i = 3;
    return c.i;
  }
};

int main() {
  B<int> a;
  B<A> b, c;

  std::cout<<a.func(c)<<b.func(c);
}

Follow CodeGalaxy

Mobile Beta

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