Question: c + + 1 . When should templates be used to implement functions? When should templates be used to implement classes? 2 . When you

c++
1. When should templates be used to implement functions? When should templates be used to implement classes?
2. When you define a class, and do not provide any constructor, then a default constructor will be provided and used automatically. Observe the following class - add necessary header files, compile and run the code, add a main function with a call to the operator << and answer the question based on your observations. (10 points)
class YourClassName
{
public:
friend ostream & operator<<(ostream & outs, const YourClassName & o)
{
outs << o.value << endl;
outs << o.dvalue << endl;
for (int i=0; i<10; i++)
outs <<"a["<

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!