-
November 24th, 2020, 04:03 AM
#1
example program
Hello ,
I am trying to solve the following example program. The code below is already there.
What i am confused , is they have defined struct template, without defining the struct itself.
Code:
#include <iostream>
using namespace std;
enum class Fruit { apple, orange, pear };
enum class Color { red, green, orange };
template <typename T> struct Traits;
int main()
{
int t = 0; std::cin >> t;
for (int i=0; i!=t; ++i) {
int index1; std::cin >> index1;
int index2; std::cin >> index2;
cout << Traits<Color>::name(index1) << " ";
cout << Traits<Fruit>::name(index2) << "\n";
}
}
I am unable to change the above red line of code to add actual struct ! I mean, the above line looks like declaration, but i want to add actual definition !!!
Please may be i am missing something. Please help me with suggestions
thanks
pdk
Last edited by pdk5; November 24th, 2020 at 04:10 AM.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|