www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/07/17/16:18:47

Date: Fri, 17 Jul 1998 15:18:08 -0500 (CDT)
From: Andrew Deren <aderen AT eecs DOT uic DOT edu>
To: Jorge Ivan Meza Martinez <jimeza AT usa DOT net>
cc: djgpp AT delorie DOT com
Subject: Re: the call of the constructor
In-Reply-To: <01bdb146$46cfea20$1c1f1bc4@default>
Message-ID: <Pine.GSO.3.96.980717151702.12714B-100000@bert.eecs.uic.edu>
MIME-Version: 1.0

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
> 
> 
> 

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019