complicated.hpp 832 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. // Copyright David Abrahams 2001.
  2. // Distributed under the Boost Software License, Version 1.0. (See
  3. // accompanying file LICENSE_1_0.txt or copy at
  4. // http://www.boost.org/LICENSE_1_0.txt)
  5. #ifndef COMPLICATED_DWA20011215_HPP
  6. # define COMPLICATED_DWA20011215_HPP
  7. # include <iostream>
  8. # include "simple_type.hpp"
  9. struct complicated
  10. {
  11. complicated(simple const&, int = 0);
  12. ~complicated();
  13. int get_n() const;
  14. char* s;
  15. int n;
  16. };
  17. inline complicated::complicated(simple const&s, int _n)
  18. : s(s.s), n(_n)
  19. {
  20. std::cout << "constructing complicated: " << this->s << ", " << _n << std::endl;
  21. }
  22. inline complicated::~complicated()
  23. {
  24. std::cout << "destroying complicated: " << this->s << ", " << n << std::endl;
  25. }
  26. inline int complicated::get_n() const
  27. {
  28. return n;
  29. }
  30. #endif // COMPLICATED_DWA20011215_HPP