Apr 4, 2012 at 7:05pm UTC
Hi,
I have more or less the following structure;
Class A {
...
class B;
friend class B;
...
Class B
{
public:
QString getS();
void setS(const QString&);
private:
QString s;
}
friend class B;
}
I've implemented getS in the cpp of Class A like
// A.cpp
QString A::B::getS()
{
}
void A::B::setS(const QString p_s)
{
s = p_s
}
The problem I experienced is; when I attempt to call setS from another class let's say Class C, I get a runtime error saying that in the assignment of s = p_s...Saying s is never created.
Any ideas?
Apr 4, 2012 at 7:47pm UTC
Show how you instantiate class B from class C, and then show how you call setS().
Apr 4, 2012 at 8:14pm UTC
I create B in class A's constructor.
I call setS from different from class C like;
a->getClassB()->setS("asdsa");
But it seems like it didn't create it properly. I debugged the code and saw it's created. But somehow it's erased I suppose. What say you?
Apr 4, 2012 at 9:20pm UTC
Show the definition of A::getClassB().