Constructor/Destructor involving a class and a struct
Posted
by
Bogdan Maier
on Stack Overflow
See other posts from Stack Overflow
or by Bogdan Maier
Published on 2012-04-11T19:12:30Z
Indexed on
2012/04/11
23:29 UTC
Read the original article
Hit count: 214
I am working on a program and need to make an array of objects, specifically I have a 31x1 array where each position is an object, (each object is basically built out of 6 ints). Here is what I have but something is wrong and i could use some help thank you.
31x1 struct header"
const int days=31;
struct Arr{
int days;
int *M;
};
typedef Arr* Array;
31x1 matrix constructor:
void constr(){
int *M;
M = new Expe[31]; // Expe is the class
class header:
class Expe {
private:
//0-HouseKeeping, 1-Food, 2-Transport, 3-Clothing, 4-TelNet, 5-others
int *obj;
}
Class object constructor:
Expe::Expe() {
this->obj=new int[6];
}
help please... because i`m pretty lost.
© Stack Overflow or respective owner