+ 1

Is there a way I can avoid using constructors and destructors but still doing the same function

Constructors & destructors...

24th Apr 2019, 8:48 AM
Earnmore Blessing Kutsiwa
Earnmore Blessing Kutsiwa - avatar
6 Respostas
+ 10
Yes if you wanted to but the complier will still provide a default for both.
24th Apr 2019, 9:11 AM
D_Stark
D_Stark - avatar
+ 4
Which language? And can you explain what exactly you want to do? And why do you want to evade constructors and destructors?
24th Apr 2019, 9:05 AM
HonFu
HonFu - avatar
+ 1
If you code in c, there is struc, but no class or constructors and destructors. If I make a non trivial structure in c, then I would make an initialize function and delete function for it. (At least that's what I did with my linked list implementation. ) When ever I make a new struc I have to manually call the initialize function, then call the delete function when I'm finished with it. You could take this approach in c++, but you should ask yourself why.
24th Apr 2019, 10:52 AM
Jared Bird
Jared Bird - avatar
0
C++
24th Apr 2019, 9:07 AM
Earnmore Blessing Kutsiwa
Earnmore Blessing Kutsiwa - avatar
0
The general use of constructors
24th Apr 2019, 9:10 AM
Earnmore Blessing Kutsiwa
Earnmore Blessing Kutsiwa - avatar
0
Thank u all
29th Apr 2019, 5:19 PM
Earnmore Blessing Kutsiwa
Earnmore Blessing Kutsiwa - avatar