Horje
c++ encapsulation Code Example
c++ encapsulation
 #include <iostream>
using namespace std;

class Employee {
  private:
    // Private attribute
    int salary;

  public:
    // Setter
    void setSalary(int s) {
      salary = s;
    }
    // Getter
    int getSalary() {
      return salary;
    }
};

int main() {
  Employee myObj;
  myObj.setSalary(50000);
  cout << myObj.getSalary();
  return 0;
} 




Cpp

Related
rotate array cpp Code Example rotate array cpp Code Example
c++ vector push if not exist Code Example c++ vector push if not exist Code Example
if c++ Code Example if c++ Code Example
cyclic array rotation in cpp Code Example cyclic array rotation in cpp Code Example
how to manually start windows app Code Example how to manually start windows app Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
10