Advertisement
Guest User

Untitled

a guest
Jan 13th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.35 KB | None | 0 0
  1. #include <iostream>
  2. #include "stdafx.h"
  3.  
  4. using namespace std;
  5.  
  6. class Object {
  7. public:
  8.     string& GetName();
  9.     int GetX();
  10. private:
  11.     string name;
  12.     int x;
  13. };
  14.  
  15. int main() {
  16.     Object o;
  17.     cout << o.GetName().c_str;
  18.     cout << o.GetX();
  19.     getchar();
  20.  
  21.     return 0;
  22. }
  23.  
  24. int Object::GetX() {
  25.     return x;
  26. }
  27.  
  28. string& Object::GetName() {
  29.     return name;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement