home *** CD-ROM | disk | FTP | other *** search
/ Reverse Code Engineering RCE CD +sandman 2000 / ReverseCodeEngineeringRceCdsandman2000.iso / RCE / Ebooks / Thinking in C++ V2 / C11 / Stopcc.cpp < prev   
Encoding:
C/C++ Source or Header  |  2000-05-25  |  481 b   |  23 lines

  1. //: C11:Stopcc.cpp
  2. // From Thinking in C++, 2nd Edition
  3. // Available at http://www.BruceEckel.com
  4. // (c) Bruce Eckel 1999
  5. // Copyright notice in Copyright.txt
  6. // Preventing copy-construction
  7.  
  8. class NoCC {
  9.   int i;
  10.   NoCC(const NoCC&); // No definition
  11. public:
  12.   NoCC(int ii = 0) : i(ii) {}
  13. };
  14.  
  15. void f(NoCC);
  16.  
  17. int main() {
  18.   NoCC n;
  19. //! f(n); // Error: copy-constructor called
  20. //! NoCC n2 = n; // Error: c-c called
  21. //! NoCC n3(n); // Error: c-c called
  22. } ///:~
  23.