Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- class Person {
- public:
- std::string first;
- std::string last;
- void printFullName() { std::cout << first << " " << last << std::endl; }
- };
- int main() {
- Person p;
- p.first = "Caleb";
- p.last = "Curry";
- std::string first = "Caleb";
- std::string last = "Curry";
- p.printFullName();
- return 0;
- // class - describes the structure
- // object - an instance of the structure
- // instance - other name of an object
- // instantiaining
- // data members - variables
- // methods - functions
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement