Created
September 30, 2018 14:24
-
-
Save ichtrojan/c5232ca1f590362be524aee52ee3168f to your computer and use it in GitHub Desktop.
Creating a second object from a class in C++
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
class human { | |
public: | |
string name; | |
int age; | |
}; | |
int main () { | |
human exhibitA; | |
human exhibitB; | |
exhibitA.name = "Michael"; | |
exhibitA.age = 25; | |
exhibitB.name = "Nerfetiti"; | |
exhibitB.age = 24; | |
cout <<"Exhibit A's Name is "<< exhibitA.name << endl; | |
cout <<"Exhibit A's Age is "<< exhibitA.age << endl; | |
cout <<"Exhibit B's Name is "<< exhibitB.name << endl; | |
cout <<"Exhibit B's Age is "<< exhibitB.age << endl; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment