GSP 125 RANK Experience Tradition / gsp125rank.com

Page 10

Question 30. 30. A class template allows (Points : 3) a class to be re-defined with different types but the same code. the compiler to ignore unused methods of the templated class. the templated type to be any type, including another templated type. All of the above Question 31. 31. Write a “Hello World” program in C++. (Points : 2) Question 32. 32. Write code for a struct called “Coin.” The Coin class should have a floating-point member for radius and thickness and weight, a c-string member for name, and an integer member for color. (Points : 7) Question 33. 33. Write code for a class called "Double." The Double class should have a single double member, value. Create accessors and mutators for value. The default constructor of Double should set value to zero. (Points : 7) Question 34. 34. Write a class named Person and create another class called Teacher, which inherits from Person (Person is the parent class and Teacher is the child class). (Points : 7) Question 35. 35. Write code that instantiates an integer and prints out its address. (Points : 7) Question 36. 36. Write the body of thfollowing function so that it returns the square of the number pointed at by the pointer argument. float square(float * valuePtr) { } (Points : 7)


Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.