I have function get_time() in a class which return a private member.
How can I use the object which called this function in the implementation of the function.
For example in case comp object which have a member call name call get_time function (comp.get_time()
):
I want to be able to get the comp.name in the implementation of the det_time_function. How can I?
e.g
class comp
{
public:
string name;
}
class calc : public comp
{
private:
int time;
public:
int get_time(){
///here I want to get the name of the object which call the calc
///should I use this.name?
}
}
calc calc_obj;
calc.get_time();