From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=BAYES_00,INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1014db,ef0074ec236ba6e3 X-Google-Attributes: gid1014db,public X-Google-Thread: 109fba,ef0074ec236ba6e3 X-Google-Attributes: gid109fba,public X-Google-Thread: 1108a1,ef0074ec236ba6e3 X-Google-Attributes: gid1108a1,public X-Google-Thread: 108717,ef0074ec236ba6e3 X-Google-Attributes: gid108717,public X-Google-Thread: 103376,b19fa62fdce575f9 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1994-11-30 07:08:29 PST Newsgroups: comp.lang.ada,comp.lang.c,comp.programming,comp.lang.c++,comp.object Path: bga.com!news.sprintlink.net!howland.reston.ans.net!usc!bloom-beacon.mit.edu!xlink.net!slsv6bt!kocher From: kocher@lts.sel.alcatel.de (Hartmut Kocher US/ESA 60/1L/2? #5629) Subject: Re: Question about class destructors...Easy??? Message-ID: <1994Nov30.145727.17816@lts.sel.alcatel.de> Sender: kocher@us-es.sel.de (Hartmut Kocher US/ESA 60/1L/2? #5629) Organization: SEL-Alcatel LTS Dept. US/ES References: <3b9s8d$m58@cleese.apana.org.au> <3bfig8$tn@news.cc.utah.edu> <3bfjul$kfh@lab2.cs.purdue.edu> Date: Wed, 30 Nov 94 14:57:27 GMT Xref: bga.com comp.lang.ada:8087 comp.lang.c:32553 comp.programming:5492 comp.lang.c++:38922 comp.object:9162 Date: 1994-11-30T14:57:27+00:00 List-Id: In article <3bfjul$kfh@lab2.cs.purdue.edu>, davisrj@cs.purdue.edu (Roy J. Davis) writes: > > I have a question regarding class destructors in c++. Can a > destructor receive any arguments?? And if one can, how would > it be done and in what instance would it be used? Destructors don't take any argument. The only way to pass some information to a destructor would be via data, e.g., data members that are read by the destructor, static or global variables. I don't see a reason why a destructor would need a parameter. Whereas it makes sense to have different constructors to create an object from different contexts, once it is constructed, it should be in a consistent state and the destructor shouldn't care how it was constructed in the first place. Also, as I said above, you always have the possibility to set a special data member during construction of the object (or dynamically at runtime) to tell the destructor how it should behave. -- +==============================|==============================+ | Dr. Hartmut Kocher | | | Technical Consultant | All opinions expressed here | | Rational GmbH | are my own. | | Rosenstrasse 7 | | | 82049 Pullach im Isartal | I know you guessed it, | | Germany | but it keeps my lawyer happy.| | Email: kocher@lts.sel.alcatel.de | +==============================|==============================+