Naming Conflict in C++: How to access a struct member called "class"

Viewed 2103

I came across a naming problem while working with the xlib library:

I'm using a struct which has a member called "class". I assume this library is mostly used in plain C programs. So there's no problem.

But I'm programming in C++ and here the name "class" is a keyword and cannot be used to denote variables. So, if I'm accessing the struct via

myvariable = mystruct->class;

I'm getting the error:

expected unqualified-id before ‘class’

Given that I cannot change the struct itself, how can I access this struct member despite the naming conflict?

6 Answers
Related