> If I make a class like this:
> class MyClass
> {
>    private:
>         char * id;
>         char * name;
>    public:
>         MyClass();
>         char * getId();
>         ..
>         ..
> }
> ..and then I want to create an array with objects from this class, how do
I
> do?
>
> if I write
>     MyClass my_class [];
>     my_class=MyClass();
>
> ..it doesn�t work. I get the compile error:
> incompatible types in assignment of `MyClass' to `MyClass[0]'

Try this:

MyClass my_class[10];

This declares an array of 10 MyClass objects.  Each will be initialized via
the default constructor.


Eric W. Sirko
Softworks Solutions, LLC



-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to