studyqueen6586 studyqueen6586
  • 29-08-2018
  • Computers and Technology
contestada

"write a short c++ program that creates a pair class that can store two objects declared as generic types."

Respuesta :

tonb
tonb tonb
  • 29-08-2018

Strictly speaking, the c++ program does not create a Pair class, but instantiates a Pair object that can store two objects as declared as generic types. Is that what you meant? (Otherwise you're looking at static members which doesn't make sense for a pair class).

class Pair

{

public:

int number;

double factor;

};



int main()

{

Pair A;

A.number = 42;

A.factor = 2.6;

return 0;

}


Answer Link

Otras preguntas

Explain too please !!!!!!!!!!!!!!!!!!
Determine where the PHD Mathematicians live. The Mathematicians who live within the enclosure made by the parabola y = x2 +2x-3 and the line y = -x + 1 have all
If f(x) is discontinuous, determine the reason. f of x equals the quantity x squared plus 4 for x less than or equal to 1 and equals x plus 4 for x greater than
- Describe how chromosomes are formed from DNA.
Graph the image of AUVW after a translation 11 units left and 3 units down.
Give 5 health career
List two applications of an echo? ​
A 10,000J battery is depleted in 2h. What power consumption is this? * A) 5000W B) 3W C) 1.4W D) 20000W show your work please
Nichol walks at a constant pace of 1.2 m/s and takes 15 minutes to get to school. Sakura walks at 1.4 m/s and takes 20 minutes to get to school. What is the d
Match each word to its correct meaning. 1. carbon sequestration carbon dioxide, water vapor, methane, nitrogen oxides, and some CFCs that absorb heat and keep i