Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 21st, 2012  |  syntax: None  |  size: 0.46 KB  |  hits: 13  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Definition of constant object of class
  2. class MojaKlasa{
  3. public:
  4. };
  5.  
  6. int main()
  7. {
  8.   const MojaKlasa a;
  9.  
  10.   return 0;
  11. }
  12.        
  13. error: uninitialized const ‘a’
  14.        
  15. class MojaKlasa{
  16. public:
  17.   MojaKlasa(){}
  18. };
  19.        
  20. $ clang++ -std=c++0x -pedantic -Wall t.cpp
  21. t.cpp:7:19: error: default initialization of an object  of const type
  22.                    'const MojaKlasa' requires a user-provided default constructor
  23.   const MojaKlasa a;
  24.                   ^
  25. 1 error generated.