Date: Fri, 17 Jul 1998 15:18:08 -0500 (CDT) From: Andrew Deren To: Jorge Ivan Meza Martinez cc: djgpp AT delorie DOT com Subject: Re: the call of the constructor In-Reply-To: <01bdb146$46cfea20$1c1f1bc4@default> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk In your miClase constructor put: miClase::miClase() :k("Whatever") { } > Hello, > > I have a class that has an object of another class like attribute, something > like this: > > class miClase > { > public: > miClase (); > > private: > Objeto k; > } > > the Objeto class: > > class Objeto > { > public: > Objeto ( String ); > } > > the problem is that when I am at miClase constructor I want to initalize the > k object, but the compiler already called de () ( empty ) constructor, that > the class Objeto hasn't. > > if I try in the miClase constructor something like "k = Objeto ( String > ("string") )" I get many errors from Ios and others, if I try "k ( String > ("string") )" it says that I cannot ( cast ) (Objeto)(miClase&). > > thanks for your help, > > jorge ivan meza martinez > http://members.xoom.com/THP > jimeza AT usa DOT net > > >