0

I m not getting how to deal with private specifier? And what is role of set() nd get(

I m not getting how to extract name from class? Please help me to get thiss

9th May 2020, 1:12 PM
Vivek Chakrawarty
Vivek Chakrawarty - avatar
3 Respuestas
+ 1
say, in class you have a private member that is string name. in your class you also have two function, one that sets private member name and the other that returns it. set_name(name) => take input and assign it to the private member. get_name() => returns the private member name. Then to extract the name you do: string name = object.get_name(); It makes sense?
9th May 2020, 1:29 PM
Gen2oo
Gen2oo - avatar
+ 1
Yes ,that is right!
9th May 2020, 6:28 PM
Gen2oo
Gen2oo - avatar
0
It means...get and set are necessary in program for extracting private data .am I right?
9th May 2020, 4:57 PM
Vivek Chakrawarty
Vivek Chakrawarty - avatar