Quantcast
Channel: beginners - openFrameworks
Viewing all articles
Browse latest Browse all 4929

Simple C++ question : setters

$
0
0

@mikechambers wrote:

I am pretty new to C++ but not to programming in general and am pulling my hair out trying to figure out an issue. I have a customer class (Follower) that extends Mover. In Follower, I have a simple setter method:

Mover target;
void Follower::setTarget(Mover _target) {
    target = _target;

    cout << (&target == &_target) << endl;
}

My problem is, that the target passed in is not stored in my class instance. If you look at the identiy check after the assignment, it is returning false.

I have other code like this that works fine, but this is not working, and I have exhausted ideas of what might be wrong. I can provide more code if necessary, but I wanted to check if I was just missing something basic, or just misunderstanding something with C++.

Thanks for any input...

mike

Posts: 6

Participants: 3

Read full topic


Viewing all articles
Browse latest Browse all 4929

Latest Images

Trending Articles



Latest Images