Advertisement
Guest User

Untitled

a guest
Apr 20th, 2014
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. template<typename TReturn, typename... TArgs>
  2. class ClassX<TReturn(TArgs...)> : public Internal::ClassXImpl<TReturn, TArgs...> {
  3. public:
  4.  
  5. using BaseTypeX = Internal::ClassXImpl<TReturn, TArgs...>;
  6. using BaseTypeX::BaseTypeX; // what is this doing exactly?
  7.  
  8. inline ClassX() noexcept = default;
  9.  
  10. // member function
  11. template<class TThis, class TFunc>
  12. inline ClassX(TThis* aThis, TFunc aFunc) {
  13. this->bind(aThis, aFunc); // note bind is implemented in the ClassXImpl class
  14. }
  15.  
  16. struct Foo
  17. {
  18. Foo(int);
  19. Foo(int, double);
  20. Foo(std::string);
  21. };
  22.  
  23. struct Bar : Foo
  24. {
  25. using Foo::Foo;
  26. };
  27.  
  28. int main()
  29. {
  30. Bar b1(42); // OK, Foo's constructors have been "inherited"
  31. Bar b2(42, 3.14); // OK too
  32. Bar b2("hello"); // OK
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement