"Philipp" <_N******************@hotmail.com> wrote in message
news:3f********@epflnews.epfl.ch...
Hello, I've got a class Lattice which is declared like that:
// file: lattice.h
class Lattice:public EventChooser{
public:
Lattice(LatticeParameters* params);
virtual ~Lattice();
// (...snip...)
private:
// How do I declare this member array in the lattice.h file?
// The following doesn't seem to work
LatticeSite** lattice; // does not compile
};
Is LatticeSite declared in this header file? If not then remember to
#include it
BTW LatticeSite** is not setting an array, this is a pointer to a pointer to
a LatticeSite object. An array would be declared like
LatticeSite lattice[10];
However, if you dont know how many elements are required at compile time
then you will have to use a pointer and then initialise it using new, e.g.
LatticeSite *lattice; // declared in class definition
LatticeSite = new lattice[x]; // declared elsewhere (i suggest
LatticeSite::init)
HTH
Allan