[CSI] explicit constructor invocation
Mikhail Nesterenko
mikhail at cs.kent.edu
Fri Jul 23 12:35:42 EDT 2021
CSIB students,
A constructor is usually invoked implicitly (without mentioning its
name). However, there is a way in C++ to invoke constructor
explicitly. The effect is to assign an object new values. For example,
for the Date class that we were working on today. The example is
available here:
http://antares.cs.kent.edu/~mikhail/classes/csi/Examples/Classes/dateConstructors.cpp
Date mydate;
// some code
mydate = Date (10,20, 30); // this explicitly invokes a constructor
// on object "mydate"
Thanks,
--
Mikhail
More information about the cs13001
mailing list