I've been trying to "integrate" C++ into myself.
But somehow I'm having a litte difficulties to integrate that whole pointer stuff into my brain.
Could someone explain to diff. to me concerning the following:
"*" in combination with "->" and as in ex.2, a class with a direct name and init param, but then in combination with the "."
"What's the difference between those two code examples ? Cause both seem to work and do the exact same thing. Must be a memory thing ? No (?)"
eg:
A class "House"
But somehow I'm having a litte difficulties to integrate that whole pointer stuff into my brain.
Could someone explain to diff. to me concerning the following:
"*" in combination with "->" and as in ex.2, a class with a direct name and init param, but then in combination with the "."
"What's the difference between those two code examples ? Cause both seem to work and do the exact same thing. Must be a memory thing ? No (?)"
eg:
A class "House"
House *OldHouse;
OldHouse = new House(100);
txtNr->setText( QVariant(OldHouse->getNr()).toString() );
OldHouse = new House(100);
txtNr->setText( QVariant(OldHouse->getNr()).toString() );
House OldHouse(100);
txtNr->setText( QVariant(OldHouse.getNr()).toString() );
txtNr->setText( QVariant(OldHouse.getNr()).toString() );
Comment