How many kinds of parameters are there in C++?
How many kinds of entities are directly parameterized in c++?
What is the output of this program?
1. #include2. using namespace std; 3. class Base 4. { 5. public: 6. Base ( ) 7. { 8. cout << "1" << endl; 9. } 10. ~Base ( ) 11. { 12. cout << "2" << endl; 13. } 14. }; 15. class Derived : public Base 16. { 17. public: 18. Derived ( ) 19. { 20. cout << "3" << endl; 21. } 22. ~Derived ( ) 23. { 24. cout << "4" << endl; 25. } 26. }; 27. int main( ) 28. { 29. Derived x; 30. }
What is the output of this program?
1. #include2. using namespace std; 3. template 4. class Test 5. { 6. public: 7. Test(); 8. ~Test(); 9. type Data(type); 10. }; 11. template 12. type Test ::Data(type Var0) 13. { 14. return Var0; 15. } 16. template 17. Test ::Test() 18. { 19. } 20. template 21. Test ::~Test() 22. { 23. } 24. int main(void) 25. { 26. Test Var3; 27. cout << Var3.Data('K') << endl; 28. return 0; 29. }
What is the output of this program?
1.. #include2. using namespace std; 3. template 4. class A 5. { 6. public: 7. A(int a): x(a) {} 8. protected: 9. int x; 10. }; 11. template 12. class B: public A 13. { 14. public: 15. B(): A ::A(100) 16. { 17. cout << x * 2 << endl; 18. } 19. }; 20. int main() 21. { 22. B test; 23. return 0; 24. }