Lets say I have a class declared in say 'Class.h' as such:
Code:
class Foobar
{
public:
struct Vertex
{
float x, y, z; // Position of vertex in 3D space
RGBquad color; // Color of vertex
};
Foobar(){};
~Foobar(){};
};
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:
#include "Class.h"
Foobar::Vertex *VertexArray;
but the problem is that it is not globally accessible! It can only be used inside Class.cpp : (
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"
Code:
#include "Class.h"
void DoSouthPark()
{
float timmy = Foobar::VertexArray[10].x;
}
* Yes I know VertexArray is not a pointer inside the Foobar class... thats what I'm trying to learn!
- Thank you very much in advanced!