Lets say I have a class declared in say 'Class.h' as such:
and I want to create an array of the Vertex structure without predefined size that can be accessed globally, I was thinking something like this: "Class.cpp"Code:class Foobar { public: struct Vertex { float x, y, z; // Position of vertex in 3D space RGBquad color; // Color of vertex }; Foobar(){}; ~Foobar(){}; };
but the problem is that it is not globally accessible! It can only be used inside Class.cpp : (Code:#include "Class.h" Foobar::Vertex *VertexArray;
I know that I am rather new to classes and pointers, but can someone please help me understand how I can have a function such as: "ExampSource.cpp"
* Yes I know VertexArray is not a pointer inside the Foobar class... thats what I'm trying to learn!Code:#include "Class.h" void DoSouthPark() { float timmy = Foobar::VertexArray[10].x; }
- Thank you very much in advanced!



LinkBack URL
About LinkBacks



