Consider the following program on the link;
https://drive.google.com/file/d/1EELCBZ58M-uxdMDZR8faLLQ45h9jLArE/view?usp=sharing
Now, consider the derived class interface, aTriplet, defined as
template <template T1, class T2, class T3>
class aTriplet : public aPair <T1, T2>
{
private:
T3 obj3; // The 3rd component of the triplet. obj1 and obj2 are inherited from aPair
public: // The get and set data functions
T3 get_obj3(); /* Returns obj3 to any calling environment*/
void set_obj3(T3 value); /* Sets the value of obj3 to value */
// The constructor -- polymorphic
aTriplet(T1 value1 = 0, T2 value2 = 0, T3 value3 = 0);
// It constructs a triple as three components: (value1, value2, value3).
~aTriplet() {} void input(); // It allows the user to enter the three components,
void display();
};
Now, write a complete C++ class implementation of the following constructor and member functions:
a) aTriplet(T1 value1 = 0, T2 value2 = 0, T3 value3 = 0);
b) void input();
c) void display();
Comments
Leave a comment