This is the mail archive of the
cygwin@sourceware.cygnus.com
mailing list for the Cygwin project.
RE: constructor problem
- To: "Leonhard Grünschloß" <gruenschloss at hotmail dot com>,<cygwin at sourceware dot cygnus dot com>
- Subject: RE: constructor problem
- From: "Kris Thielemans" <kris dot thielemans at csc dot mrc dot ac dot uk>
- Date: Mon, 21 Feb 2000 12:51:31 -0000
- Reply-To: <kris dot thielemans at csc dot mrc dot ac dot uk>
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@sourceware.cygnus.com
> [mailto:cygwin-owner@sourceware.cygnus.com]On Behalf Of Leonhard
> Grünschloß
> Sent: 21 February 2000 13:44
> To: cygwin@sourceware.cygnus.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@sourceware.cygnus.com