home *** CD-ROM | disk | FTP | other *** search
- // ex08006.cpp
- // Overloaded @ operator
- #include <iostream.h>
- #include <string.h>
-
- class Name {
- char name[25];
- public:
- void display() { cout << '\n' << name; }
- friend char * operator&(Name& nm) { return nm.name; }
- };
-
- main()
- {
- Name names[5];
- for (int i = 0; i < 5; i++) {
- cout << "\nEnter a name: ";
- cin >> &names[i];
- }
- for (i = 0; i < 5; i++)
- cout << '\n' << &names[i];
- }