PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV (précédentes versions) → WD18: Wrong constructor call when initializing an object
WD18: Wrong constructor call when initializing an object
Débuté par Nicolas Chari, 12 jan. 2015 15:48 - Aucune réponse
Posté le 12 janvier 2015 - 15:48
Hey everybody,
I got an issue compiling this code:

Class = Shift
Procedure ProduceAppointments()
lAppointmentsArray is an array of dynamic Appointment

FOR EACH lShiftRequirement OF _shiftRequirements
FOR i = 1 TO lShiftRequirement.numberOfEmployees
lAppointment is an Appointment(object, lShiftRequirement.skills)
ArrayAdd(lAppointmentsArray, lAppointment)
END
END
RESULT lAppointmentsArray


At line
lAppointment is an Appointment(object, lShiftRequirement.skills)

program crashes and the error code says that I call the Shift constructor, needing 4 parameters and that I give none.
I don't really know why it calls the Shift constructor; "Object" is a Shift, but we don't need a constructor since it already exists, right?
Also, if you wondered, there is no call to the Shift constructor in the Appointment constructor:
Procedure Constructor(pShift is a Shift, pSkillsNeeded is an array of dynamic Skill)
PRIVATE
:_associatedShift= pShift
:_skillsNeeded= pSkillsNeeded


Here is the Shift Constructor if you want it:
Procedure Constructeur(pLabel is a string,
pStartingTime is a DateTime,
pEndingTime is a DateTime,
pShiftRequirements is an array of dynamic ShiftRequirements)
...


If someone has an idea how to solve this, it would help me a lot, I'm stuck :(

Thanks in advance.