PC SOFT

GRUPOS DE DISCUSSÃO PROFISSIONAL
WINDEVWEBDEV e WINDEV Mobile

Inicio → WINDEV (versões anteriores) → WD18: Wrong constructor call when initializing an object
WD18: Wrong constructor call when initializing an object
Iniciado por Nicolas Chari, jan., 12 2015 3:48 PM - Sem resposta
Publicado em janeiro, 12 2015 - 3:48 PM
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.