Guest User

Untitled

a guest
Jul 13th, 2012
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.54 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. template<class T, const int k>
  4. class TemplatedClass {
  5.   private:
  6.     T one;
  7.     int two;
  8.   public:
  9.     TemplatedClass():one(),two(k){}
  10.     TemplatedClass(const T t_, const int& k_):one(t_),two(k_){}
  11.     void GetOne(const T& one_ ){one=one_;}
  12.     const T& One(void) const { return one; }
  13.     const int& Two(void) const { return two; }
  14. };
  15.  
  16. int main() {
  17.   const int cnt(0u);
  18.   typedef TemplatedClass<char,decltype(cnt)> TCC;
  19.   TCC tcc;
  20.   tcc.GetOne('a');
  21.   std::cout << tcc.One() << " // " << tcc.Two() << std::endl;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment