What is other name of full specialization?
How many types of specialization are there in c++?
What is the output of this program?
1. #include2. using namespace std; 3. template class A 4. { 5. public: 6. A(); 7. int value; 8. }; 9. template<> class A<> 10. { 11. public: A(); 12. }; 13. template<> class A 14. { 15. public: A(); 16. }; 17. template A ::A() : value(i) 18. { 19. cout << value; 20. } 21. A<>::A() 22. { 23. cout << "default"; 24. } 25. A ::A() 26. { 27. cout << "10" << endl; 28. } 29. int main() 30. { 31. A x; 32. A<> y; 33. A z; 34. }
What is the output of this program?
1. #include2. #include 3. #include 4. using namespace std; 5. template 6. type MyMax(const type Var1, const type Var2) 7. { 8. cout << "no specialization"; 9. return Var1 < Var2 ? Var2 : Var1; 10. } 11. template <> 12. const char *MyMax(const char *Var1, const char *Var2) 13. { 14. return (strcmp(Var1, Var2)<0) ? Var2 : Var1; 15. } 16. int main() 17. { 18. string Str1 = "class", Str2 = "template"; 19. const char *Var3 = "class"; 20. const char *Var4 = "template"; 21. const char *q = MyMax(Var3, Var4); 22. cout << q << endl; 23. return 0; 24. }
What is the output of this program?
1. #include2. using namespace std; 3. template 4. class XYZ 5. { 6. public: 7. void putPri(); 8. static T ipub; 9. private: 10. static T ipri; 11. }; 12. template 13. void XYZ ::putPri() 14. { 15. cout << ipri++ << endl; 16. } 17. template T XYZ ::ipub = 1; 18. template T XYZ ::ipri = 1.2; 19. int main() 20. { 21. XYZ a; 22. XYZ b; 23. a.putPri(); 24. cout << a.ipub << endl; 25. b.putPri(); 26. }
a) 1
b) 1.2
c) 1
1.2
d) 1
1
1.2