[ECOS] Can I use the dynamic memory allocation on the class object? Thanks a lot.
QiangHuang
jameshq@liverpool.ac.uk
Tue Apr 29 17:14:00 GMT 2003
Hi all:
I would like to use the dynamic memory allocation on the Class object
creation, but how is its associated class constructor called?
foe example:
class my_class
{
public:
int a
my_class() { a=100;}
~my_class(){};
}
my_class *pclass = malloc(sizeof(my_class));
// by now has the my_class constructor been called?, or should I call it by myself?
// I have tried the following: (I guess only the global class object constructor will be called when system started)
pclass->my_class(); // error
// or must I set it by
pclass->a=100;
thanks a lot.
--
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss
More information about the Ecos-discuss
mailing list