Guest User

Untitled

a guest
Mar 10th, 2015
244
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.56 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. class Base
  4. {
  5. public:
  6.     Base(int i) : _i(i) {}
  7.  
  8.     void set(int val) { _b = new InBase(val); }
  9.  
  10. private:
  11.     int _i;
  12.    
  13.     class InBase;
  14.  
  15.     InBase *_b;
  16. };
  17.  
  18. class Base::InBase
  19. {
  20. public:
  21.     InBase(int j) : _j(j) {}
  22.     int get() const { return _j; }
  23.  
  24. private:
  25.     int _j;
  26. };
  27.  
  28.  
  29. Errors I get:
  30. 1>c:\users\alon\documents\visual studio 2010\projects\test2\test2\test.h(8): error C2514: 'Base::InBase' : class has no constructors
  31. 1>          c:\users\alon\documents\visual studio 2010\projects\test2\test2\test.h(13) : see declaration of 'Base::InBase'
Advertisement
Add Comment
Please, Sign In to add comment