Search
 
SCRIPT & CODE EXAMPLE
 

CPP

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;
} 
Comment

c++encapsulation

git clone https://gitlab.crio.do/crio_bytes/me_encapsulation.git

git clone git@gitlab.crio.do:crio_bytes/me_encapsulation.git
Comment

PREVIOUS NEXT
Code Example
Cpp :: c++ cast to type of variable 
Cpp :: To Lower Case leetcode solution in c++ 
Cpp :: c++ thread incide class 
Cpp :: c++ string to int 
Cpp :: find second highest number in c++ 
Cpp :: how to append to a vector c++ 
Cpp :: how to read files in c++ 
Cpp :: c++ vector resize 
Cpp :: conditional operator in c++ 
Cpp :: to lowercase c++ 
Cpp :: currency converter c++ 
Cpp :: what is - in c++ 
Cpp :: cpp mark getter as const 
Cpp :: float to int c++ 
Cpp :: how to use toString method in C++ 
Cpp :: cpp while 
Cpp :: c++ hello world linux 
Cpp :: function overloading in c++ 
Cpp :: length of number c++ 
Cpp :: binary search in c++ 
Cpp :: size of a matrix using vector c++ 
Cpp :: map in c 
Cpp :: how to convert string to int in c++ 
Cpp :: number of nodes of bst cpp 
Cpp :: stl in c++ 
Cpp :: range based for loop c++ 
Cpp :: C++ program for Celsius to Fahrenheit and Fahrenheit to Celsius conversion using class 
Cpp :: for statement c++ 
Cpp :: what was the piep piper app 
Cpp :: opengl draw house using glut c++ 
ADD CONTENT
Topic
Content
Source link
Name
3+4 =