Mail Archives: djgpp/1998/07/17/16:18:47
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 -