@PieterP : Thanks for your help. I made the changes you requested and it still resulted in errors (at bottom). I will also include all other relevant info (which is probably repeated in first post) to make sure we are in the same page :
Box.h
class Box {
private:
Debug &_debug;
public:
Box(Debug &debug);
};
Box.cpp
Box::Box(Debug &debug) :
_debug(debug) {
pinMode(28, INPUT_PULLUP);
}
Puzzle.h
#include "Debug.h"
#include "Box.h"
class Puzzle {
private:
Debug _debug;
Box _box;
public:
void setup();
void loop();
};
Puzzle.cpp
void Puzzle::setup(){
_debug = Debug();
_box = Box(_debug);
_debug.line("Puzzle Setup");
}
void Puzzle::loop(){
}
Errors
sketch\Puzzle.cpp: In member function 'void Puzzle::setup()':
Puzzle.cpp:6:20: error: use of deleted function 'Box& Box::operator=(Box&&)'
_box = Box(_debug);
^
In file included from sketch\Puzzle.h:5:0,
from sketch\Puzzle.cpp:1:
sketch\Box.h:6:7: note: 'Box& Box::operator=(Box&&)' is implicitly deleted because the default definition would be ill-formed:
class Box {
^~~
Box.h:6:7: error: non-static reference member 'Debug& Box::_debug', can't use default assignment operator
Main:3:8: error: use of deleted function 'Puzzle::Puzzle()'
Puzzle puzzle;
^~~~~~
In file included from D:\project\escape\puzzle box\source\Main\Main.ino:1:0:
sketch\Puzzle.h:7:7: note: 'Puzzle::Puzzle()' is implicitly deleted because the default definition would be ill-formed:
class Puzzle {
^~~~~~
Puzzle.h:7:7: error: no matching function for call to 'Box::Box()'
In file included from sketch\Puzzle.h:5:0,
from D:\project\escape\puzzle box\source\Main\Main.ino:1:
sketch\Box.h:10:5: note: candidate: Box::Box(Debug&)
Box(Debug &debug);
^~~
sketch\Box.h:10:5: note: candidate expects 1 argument, 0 provided
sketch\Box.h:6:7: note: candidate: constexpr Box::Box(const Box&)
class Box {
^~~
sketch\Box.h:6:7: note: candidate expects 1 argument, 0 provided
sketch\Box.h:6:7: note: candidate: constexpr Box::Box(Box&&)
sketch\Box.h:6:7: note: candidate expects 1 argument, 0 provided
exit status 1
use of deleted function 'Box& Box::operator=(Box&&)'
I'm guessing this is because _debug and _box need to be defined. I tried to do this prior using the member initialization list and could not get it to work.
Thanks for everyones help