User Tools

Site Tools


c:c_this_pointer

C - C++ This Pointer

#include <iostream> 
using namespace std; 
 
class MyClass 
{ 
  int i; 
 
public: 
  void setI(int val) 
  { 
    this->i = val; 
  }  
 
  int getI() 
  { 
    return this->i; 
  }  
} ; 
 
 
int main() 
{ 
  MyClass o; 
 
  o.setI(100); 
  cout << o.getI(); 
 
  return 0; 
}
c/c_this_pointer.txt · Last modified: 2020/07/15 09:30 by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki