need help getting member values from an object pointer in a class function
title pretty much describes my problem. i can't get the member values of class objects in that class function. i'll post the parts in question to show what it currently looks like. i've altered it every which way a beginner like me can think to do. and can't seem to get the value. ========================================================= class character //only included parts relevant to question { public: void Strike(character *target) /*originally &target and i used target.member instead of target->member */ { genericint = (this->striking + randomint(0, 10)) - (target->dodge + randomint(0, 10)); //the above values always = 0-10. if (genericint > 0) { genericfloat = (this->striking / 10) * (this->strength/2); target->chealth -= genericfloat; genericint = genericfloat; genericstring = this->name; cout << genericstring << " Strikes " << target->name << "! dealing " << genericint << " damage." << endl; //results in " Strikes ! dealing damage." same problem on both couts. genericfloat = (target->chealth/target->health) * 100; genericint = genericfloat; genericint = genericfloat; cout << target->name << " has " << genericint << "% health left." << endl; } else { cout << target->name << " Avoids " << this->name << "'s attack" << endl; } } } int main() { character C1("John", 55, 0, 5, 5); //irrelevant details character C2("Cathy", 23, 1, 4, 2);//irrelevant details character *c1 = &C1; character *c2 = &C2; c2->Strike(c1); return 0; }