i made a test program, this line " *ps.Working_Hours=10;" generates mistake.
why ?

#include <cstdlib>
#include <iostream>

using namespace std;

class Salary
             int Working_Hours;
             float hour_rate;
             float x;

int main(int argc, char *argv[])
    Salary s;
    float yy;
    Salary* ps;
    cout <<  "s.hour_rate="   <<s.hour_rate<<"\n"<<"ps->s.hour_rate"<<ps->Working_Hours<<endl;
    return EXIT_SUCCESS;

You created ps as a pointer, and you are attempt to use pointer of pointer to assign a value... I can't remember the exact syntax for this assignment... I am sure that someone else knows the exact syntax.


The "dot" operator has a higher prededence than the dereference operator. You can do it this way, but you need to use parentheses to make it work properly, which tends to make it klunky.

(*ps).Working_Hours = 10;

Alternatively, you can avoid this issue completely by using the "arrow" operator to handle all of that for you:

ps->Working_Hours = 10;

thank you it was so easy.
i missed simple mistake