A
Angus
I have a class B which is constructed with a pointer to a class A.
If class A is like this:
class A
{
public:
BigStruct getBigStruct() const { return m_struct; }
private:
BigStruct m_struct;
}
And I need to access m_struct from B, and B has a A* (pA) then when I
call:
pA->getBigStruct()->Operation();
What happens here?
As pA is a pointer, we are dereferencing the pointer and the call to
getBigStruct - does that do any copying?
I don't want to copy a laege object around. Should I be returning a
reference? What is best way to do this?
Angus
If class A is like this:
class A
{
public:
BigStruct getBigStruct() const { return m_struct; }
private:
BigStruct m_struct;
}
And I need to access m_struct from B, and B has a A* (pA) then when I
call:
pA->getBigStruct()->Operation();
What happens here?
As pA is a pointer, we are dereferencing the pointer and the call to
getBigStruct - does that do any copying?
I don't want to copy a laege object around. Should I be returning a
reference? What is best way to do this?
Angus