set and get in c 2b 2b

Solutions on MaxInterview for set and get in c 2b 2b by the best coders in the world

showing results for - "set and get in c 2b 2b"
Sofie
16 Feb 2018
1/*Get or Set are methods to Access Private Members 
2for example */
3
4class Employee {
5  private:
6    // Private attribute
7    int salary;
8
9  public:
10    // Setter
11    void setSalary(int s) {
12      salary = s;
13    }
14    // Getter
15    int getSalary() {
16      return salary;
17    }
18};
19
20int main() {
21  Employee myObj;
22  myObj.setSalary(50000);
23  cout << myObj.getSalary();
24  return 0;
25}
26
queries leading to this page
c 2b 2b get and settercreate get and set c 2b 2bget and set methods in c 2b 2bget set c 2b 2bget and set cppget and set function c 2b 2b examplec 2b 2b get und set c 2b 2b set getaccess to set c 2b 2bc 2b 2b setset and get function c 2b 2bsetter and getter in c 2b 2bc 2b 2b get and set functionsget set method in c 2b 2bc 2b 2b program with get and setset and get methods in c 2b 2bhow to get a variable from a set in c 2b 2bget and set function c 2b 2bget set element c 2b 2bc 2b 2b get and setget in set cppcpp get setset get element c 2b 2bone set method c 2b 2bset and get in c 2b 2bset get c 2b 2bset and get in cppget and set c 2b 2bhow to get a variable from a set class in c 2b 2bhow to read a set in c 2b 2bc 2b 2b set and gethow to make set and get in c 2b 2bcpp get from setget value from a set in c 2b 2bcpp class get setget element in set c 2b 2bhow to get element from set in c 2b 2bset and get function in c 2b 2bhow to get elements from set in c 2b 2bget set in c 2b 2bset and get functions c 2b 2bget and set cpp 5cget and set function in c 2b 2bset and get functions in c 2b 2bis there get and set in c 2b 2bwhat is the set method used for c 2b 2bc 2b 2b get set functionsset get method in c 2b 2bget element from set c 2b 2bget and set example c 2b 2bset get value cppset 26 get function in c 2b 2bget set function c 2b 2bc 2b 2b get setget an element from set c 2b 2bget elements in set c 2b 2bget values in set c 2b 2busing set and get function in c 2b 2bget set in cppget and set methods c 2b 2bc 2b 2b set getset 28 29 in c 2b 2bdeclare get set c 2b 2bget and set in c 2b 2bset and get method in c 2b 2bget value from set c 2b 2bset and get in c 2b 2b