This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Can I use the dynamic memory allocation on the class object? Thanks a lot.
- From: "QiangHuang" <jameshq at liverpool dot ac dot uk>
- To: "Ecos-Discuss" <ecos-discuss at sources dot redhat dot com>
- Date: Tue, 29 Apr 2003 18:07:09 +0100
- Subject: [ECOS] Can I use the dynamic memory allocation on the class object? Thanks a lot.
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