class Room {
public:
Room() { array = newint[10]; }
~Room() { delete [] array; }
int *array;
}
int main() {
Room myRoom;
myRoom.array[0] = 4;
return 0;
}
This isn't a very nice way to do it though. I'd recommend you look at using a std::vector instead. This example also breaks good OO convention by not encapsulating access to the pointer.
You have not given us the exact code or error messages, leading everyone to respond on the wrong trail.
I think that are you are trying to do something that requires a const value, but your class is not const-correct, causing your compiler to complain about the lack of constness.