Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

pointer in cpp details

#include <iostream>
using namespace std;
class Demo {
private:
  int num;
  char ch;
public:
  void setMyValues(int num, char ch){
    this->num =num;
    this->ch=ch;
  }
  void displayMyValues(){
    cout<<num<<endl;
    cout<<ch;
  }
};
int main(){
  Demo obj;
  obj.setMyValues(100, 'A');
  obj.displayMyValues();
  return 0;
}
Source by beginnersbook.com #
 
PREVIOUS NEXT
Tagged: #pointer #cpp #details
ADD COMMENT
Topic
Name
3+2 =