Hi, I have just started learning C++ and I usually code in Java.
I created a class Shift which is compose of n amount of ShiftBloc (which is like a working shift split into ex 8 hours of shift) each ShiftBlocs are taking as argument an instance of the class Time. No matter what I do it keeps saying that there are no instance of such a constructor:
ShiftBloc::ShiftBloc(Time startTime) {...}
So I can't do (with an instance of Time) -> ShiftBloc s = ShiftBloc(startTime);
I can only instanciate Shift with it's default constructor Shift()
I tried creating a constructor with just an int as an argument and it works so it seems that it's only when I try to pass a class I created as an argument... The answer is probably very simple but I can't seem to find the problem and I've been looking for a while :(
ShiftBloc::ShiftBloc() {}
Your functions are already in the class scope, you do not need to do that. Just do this: ShiftBloc() {}
and the same for the rest. Where did you learn this from?
Many tutorial seems to include the scope anyway but I admit it's superfluous. As you can see I didn't do it on the other classes :p
But still, it doesn't solve my problem
*Edit: actualy, it was because I tryed to put the functions in a cpp instead to see if it could be where the problem lies :S ... I tryed alot of different possibilities without success. I just copy pasted them back into the header without removing the scope.
William