daily pastebin goal
28%
SHARE
TWEET

Untitled

a guest Jul 11th, 2018 82 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. template <typename T>
  2. class ExtendedType
  3. {
  4. public:
  5.     T object;
  6. ExtendedType(const T & source) : object(source){std::cout<<"konstruktor przyjmujacy stala referencje do T\n";}
  7. ExtendedType(T && source) : object(std::move(source)){std::cout<<"konstruktor przenoszacy: "<<object<<"\n";}
  8. ...
  9. }
  10.  
  11. class Foo
  12. {
  13. public:
  14.     ExtendedType<int> obj;
  15.     Foo(int x = 1234) : obj(x){std::cout<<"domyslny Foo \n";}
  16.     ...
  17. }
  18.  
  19. int main()
  20. {
  21.     Foo a(5);                           // wypisuje: konstruktor przyjmujacy stala referencje do T
  22.     ExtendedType<int> b(10);            // wypisuje: konstruktor przenoszacy obiekt: 10
  23. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top