This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
RE: Can I use the dynamic memory allocation on the class object? Thanks a lot.
- From: "Schumacher, Gordon" <gordon_schumacher at maxtor dot com>
- To: "'QiangHuang'" <jameshq at liverpool dot ac dot uk>, Ecos-Discuss <ecos-discuss at sources dot redhat dot com>
- Date: Tue, 29 Apr 2003 11:14:55 -0600
- Subject: RE: [ECOS] Can I use the dynamic memory allocation on the class object? Thanks a lot.
Is there something obvious that I'm missing - is there a reason you're not
using the following?
my_class *pclass = new my_class;
If I'm not dreadfully mistaken, that's dynamic allocation...
# -----Original Message-----
# From: QiangHuang [mailto:jameshq at liverpool dot ac dot uk]
# Sent: Tuesday, April 29, 2003 11:07 AM
# To: Ecos-Discuss
# 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
--
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss