delorie.com/archives/browse.cgi | search |
Mailing-List: | contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm |
List-Subscribe: | <mailto:cygwin-subscribe AT sourceware DOT cygnus DOT com> |
List-Archive: | <http://sourceware.cygnus.com/ml/cygwin/> |
List-Post: | <mailto:cygwin AT sourceware DOT cygnus DOT com> |
List-Help: | <mailto:cygwin-help AT sourceware DOT cygnus DOT com>, <http://sourceware.cygnus.com/ml/#faqs> |
Sender: | cygwin-owner AT sourceware DOT cygnus DOT com |
Delivered-To: | mailing list cygwin AT sourceware DOT cygnus DOT com |
Reply-To: | <kris DOT thielemans AT csc DOT mrc DOT ac DOT uk> |
From: | "Kris Thielemans" <kris DOT thielemans AT csc DOT mrc DOT ac DOT uk> |
To: | "=?iso-8859-1?B?TGVvbmhhcmQgR3L8bnNjaGxv3w==?=" <gruenschloss AT hotmail DOT com>, |
<cygwin AT sourceware DOT cygnus DOT com> | |
Subject: | RE: constructor problem |
Date: | Mon, 21 Feb 2000 12:51:31 -0000 |
Message-ID: | <002101bf7c6a$606a4ca0$1d4bb392@petnt1.rpms.ac.uk> |
MIME-Version: | 1.0 |
X-Priority: | 3 (Normal) |
X-MSMail-Priority: | Normal |
X-Mailer: | Microsoft Outlook 8.5, Build 4.71.2377.0 |
In-Reply-To: | <20000221124333.96807.qmail@hotmail.com> |
X-MimeOLE: | Produced By Microsoft MimeOLE V4.72.2120.0 |
Importance: | Normal |
Dear Leonhard, This is just C++. In your first constructor, you are just constructing a local object with the 1st constructor. You are not 'calling the constructor function on the same object'. Constructors are not ordinary functions. To do something like you want, you would have to have a 3rd function class A { A() { f(); } A(int a) { f(); /*do something with a*/ }; void f() { /*blabla*/ } }; There are some restrictions on which functions you can call from within constructors though (notably: do not call virtual functions). Kris > -----Original Message----- > From: cygwin-owner AT sourceware DOT cygnus DOT com > [mailto:cygwin-owner AT sourceware DOT cygnus DOT com]On Behalf Of Leonhard > Grünschloß > Sent: 21 February 2000 13:44 > To: cygwin AT sourceware DOT cygnus DOT com > Subject: constructor problem > > > I don't know if that's Cygwin specific, but that's my problem: > If I call a second constructor from the first constructor it is > called, but > the (private) variables it changed aren't changed when it returns to the > first constructor. Why not? How else can I call the constructor > so that its > actions aren't "undone"? > --OyL -- Want to unsubscribe from this list? Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |