Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- template<class T, const int k>
- class TemplatedClass {
- private:
- T one;
- int two;
- public:
- TemplatedClass():one(),two(k){}
- TemplatedClass(const T t_, const int& k_):one(t_),two(k_){}
- void GetOne(const T& one_ ){one=one_;}
- const T& One(void) const { return one; }
- const int& Two(void) const { return two; }
- };
- int main() {
- const int cnt(0u);
- typedef TemplatedClass<char,decltype(cnt)> TCC;
- TCC tcc;
- tcc.GetOne('a');
- std::cout << tcc.One() << " // " << tcc.Two() << std::endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment