I have a pointer to a class and I'm trying to use it to access the class' public struct. I've looked at access member var using ptr, as well as access memb struct from ptr class, but when you look at the links, it's not what I'm trying to do.
I'm having trouble doing something that will build. The examples in the code are without pointers, but I have a pointer to IFM to work with. Does anyone know how to use the pointer (to IFM) to access the public struct (in IFM)?
//snippet of code that is trying to access struct in IFM:
const IFM *pJunk = rData1.getM(); //this is fine
pJunk->JunkStruct::Junk.xs; //this doesn't work
The struct in IFM.h:
class IFM final public IFO
{
public:
typedef struct JunkStruct
{
JunkStruct() = default;
~JunkStruct() = default;
JunkStruct(const IFM::JunkStruct&) = default;
JunkStruct(const double& first, const double& second, const double& third, const double& fourth, const double& fifth, const double& sixth) :
xs(first), ysk(second), xsk(third), ys(fourth), x(fifth), y(sixth)
{}
IFM::JunkStruct& operator=(const IFM::JunkStruct&) = default;
// Initialized
double xs = 1.0;
double ys = 0.0;
double xsk = 0.0;
double ysk = 1.0;
double x = 0.0;
double y = 0.0;
} Junk;
...
Aucun commentaire:
Enregistrer un commentaire