C
Chris Morse
I'm working to convert some C code to VB.NET and one of the issues I'm
faced with is that of pointers to structures.
Consider this C structure:
typedef struct vertex_type {
double x;
double y;
vertex_type* next;
} vertex;
Converting this to VB.NET doesn't seem really possible. Structures
are value types, and so cannot contain an instance of itself.
Public Structure vertex
Public x as Double
Public y as Double
Public [next] As ???
End Structure
My guess is that I must promote this to a class:
Public Class vertex
Public x as Double
Public y as Double
Public [next] As vertex
End Class
Of course, this changes the semantics of the vertex type - it's no
longer a value type.
Is there a better solution? Is there a way to create a pointer to the
structure so it can be implemented as a structure and not a class?
Any help or pointers (pun intended!) apprecaited!
// CHRIS
faced with is that of pointers to structures.
Consider this C structure:
typedef struct vertex_type {
double x;
double y;
vertex_type* next;
} vertex;
Converting this to VB.NET doesn't seem really possible. Structures
are value types, and so cannot contain an instance of itself.
Public Structure vertex
Public x as Double
Public y as Double
Public [next] As ???
End Structure
My guess is that I must promote this to a class:
Public Class vertex
Public x as Double
Public y as Double
Public [next] As vertex
End Class
Of course, this changes the semantics of the vertex type - it's no
longer a value type.
Is there a better solution? Is there a way to create a pointer to the
structure so it can be implemented as a structure and not a class?
Any help or pointers (pun intended!) apprecaited!
// CHRIS