ProgrammingNeed help with C++ template functions
Posted:
ProgrammingNeed help with C++ template functionsPosted:
Status: Offline
Joined: Jul 15, 20168Year Member
Posts: 795
Reputation Power: 118
Trying to do an assignement and was wondering if anyone knew how to convert a simple class to a template class?
Code: class TwoValues { public: TwoValues(int i, int j); bool equal(); private: int a, b; }; TwoValues::TwoValues(int i, int j) : a(i), b(j) { } bool TwoValues::equal() { return a == b; } |
#2. Posted:
Status: Offline
Joined: Nov 05, 201311Year Member
Posts: 2,749
Reputation Power: 452
Status: Offline
Joined: Nov 05, 201311Year Member
Posts: 2,749
Reputation Power: 452
I don't what you're trying to do but start here. geeksforgeeks.org/templates-cpp/
use it like this and don't use my terrible function and variable names.
|
- 1useful
- 0not useful
Users browsing this topic: None