bsc

Comprehensive codebase and coursework for the 4-year B.Sc. Computer Science Honours degree (WBSU)

git clone https://github.com/notamitgamer/bsc.git
· rebuilt hourlyOpen on GitHub
root / semester_2 / eduincs / pgrm_014.cpp

pgrm_014.cpp (409B)


      1 /* `this` pointer */
      2 
      3 #include<iostream>
      4 using namespace std;
      5 class myclass {
      6 private:
      7 	int value1;
      8 	int value2;
      9 public: 
     10 	void setValue(int v, int value2) {
     11 		this -> value1 = v;
     12 		this -> value2 = value2;
     13 	}
     14 	void printValue() {
     15 		cout << "Value1: " << this -> value1 << endl;
     16 		cout << "Value2: " << this -> value2;
     17 	}
     18 };
     19 
     20 int main() {
     21 	myclass obj;
     22 	obj.setValue(23, 123);
     23 	obj.printValue();
     24 	return 0;
     25 }