0

wow, haven't been here for sometimes due to the business aspect of my course.
would like some help in understanding what is set, get, change and return in c++.
have an assignment with topics the class haven't covered as yet, but I'd love to understand it before we reach those topic, don't want to post the partial codes that i have written so far until i think i'm finish so you ppl can take a look on it and tell me where i am going wrong.
tnx again for your help.

3
Contributors
5
Replies
6
Views
7 Years
Discussion Span
Last Post by Ancient Dragon
0

nova2177,

There is nothing official about set/get/change in c++.
Set/Get or Setter/Getter - The basic premise of a getter/setter is to you give access to a private field within your class, thus allowing a user of that class to alter the state of that fields without knowing about or interfering with any other piece of the class.

return [expression]

return statement - It terminates the execution of a function and returns control to the calling function. If value of expression, if present then it is returned to the calling function.

Here are some useful links:
Thinking in C++
Design Pattern

0

thanks for the info and the links adatapost, but the change, i have been googling and searching through books but i can't find a thing on it, does it have some special name, like get (accessor) or set (mutator).
thanks again.

0

No special name for it -- its name can be almost anything. All it would do is change the value of a variable from one value to something else. And you can code a change method any way you want, or not at all. I normally do not include a change function -- just use the set function to change a value.

0

thanks Ancient Dragon, i put in the change, but i just wasn't sure, i saw in the book that set can mutate, or change but wasn't sure how to do it.
without giving too much on my project i had this:
change_somethinghere(); //and down the bottom

void theclass : : change_somethinghere (int somethinghere)
{
}
thanks again people for the support.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.