Skip to content

Instantly share code, notes, and snippets.

@ichtrojan
Created September 30, 2018 14:20
Show Gist options
  • Save ichtrojan/03e4cd3ba3a50cbfdae3f9a54e3bc174 to your computer and use it in GitHub Desktop.
Save ichtrojan/03e4cd3ba3a50cbfdae3f9a54e3bc174 to your computer and use it in GitHub Desktop.
Creating a new object from a class in C++
#include <iostream>
using namespace std;
class human {
public:
string name;
int age;
};
int main () {
  human exhibitA;
exhibitA.name = "Michael";
  exhibitA.age = 25;
cout <<"Exhibit A's Name is "<< exhibitA.name << endl;
cout <<"Exhibit A's Age is "<< exhibitA.age << endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment