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.

Recommended Answers

All 5 Replies

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

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.

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.

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.

That would be the same code as a set() function. No point coding the same thing twice.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.