I'm somewhat new to C++, and this question has been nagging at me. Is it more efficient to use a Pointer, or an actual object?
Here's an example:
class SomeObject{
public:
SomeObject();
/* Other methods */
};
int main(int argc, char **arcv){
SomeObject *ptrObj = new SomeObject();
// Do something with ptrObj
SomeObject normObj();
// Do the same something with normObj
}
Is storing the object's pointer, and dereferencing it to access methods/field, faster than storing it as a normal object, and calling the method/accessing the fields normally?