Initialize array in a class

Hi people i have a little conceptual problem here


1
2
3
4
5
6
7
8
9
10

class Polymer {

public:
	Conformation(int N);
	Conformation(char *filename);
	virtual ~Conformation();
	Monomer chain[N][DIM];	// Polymer chain
}


What should i do for this case
- Change Monomer chain[N][DIM] to Monomer *chain and make the memory allocation in the constructor or exist another way for this an optimize way would be better.

thanks in advance
closed account (zb0S216C)
Conformation( )? What's that? They aren't constructors.

Simple answers: You can't initialise an array data member outside a constructor. You can declare one, though. Honestly, though, your question is too obscure.

Wazzak
Topic archived. No new replies allowed.