CurtisJC CurtisJC - 1 month ago 7
C++ Question

Creating my own 'data type'

I want to be able to create a type that has 3 floats (x,y,z). I have tried:

typedef struct
{
float x;
float y;
float z;
} Vertex;


But that didn't work.

Does this have to be declared somewhere where it can be seen by
main
? How would I go about creating getter methods and other methods for a type I have made?

Answer

does this have to be declared somewhere where it can be seen by main?

Yes. Typically the class or struct is declared in a header file, which you #include in whatever translation unit (c file) you use it in.