Created
May 22, 2013 15:22
-
-
Save sprintr/5628443 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 Student { | |
| private: | |
| string name; | |
| public: | |
| void setName(string n) { | |
| name = n; | |
| } | |
| void printName() { | |
| cout << name << endl; | |
| } | |
| }; | |
| class Teacher { | |
| private: | |
| string name; | |
| public: | |
| void setName(string n) { | |
| name = n; | |
| } | |
| void printName() { | |
| cout << name << endl; | |
| } | |
| }; | |
| int main() { | |
| Student s1; | |
| Teacher t1; | |
| s1.setName("Syed Hizbullah"); | |
| t1.setName("Ms. Kanza"); | |
| s1.printName(); | |
| t1.printName(); | |
| return 0; | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment