Skip to content

Instantly share code, notes, and snippets.

@sprintr
Created May 22, 2013 15:22
Show Gist options
  • Select an option

  • Save sprintr/5628443 to your computer and use it in GitHub Desktop.

Select an option

Save sprintr/5628443 to your computer and use it in GitHub Desktop.
#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