[Dev-C++] I am rusty - help with strings please!
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Daniel G. <sp...@ho...> - 2002-10-17 10:46:56
|
My skills are shot.
I am trying to create a quick program that has a class with a private member
that is an employee's name, and one of the member functions (public) returns
a pointer to that private member (it's an example of what not to do).
The program's main function should go like this:
Create a class object.
Create a global pointer.
Ask for user name.
Call SetEmployeeName passing the object to it.
Set the typed string to be the private member EmpName.
Return to main.
Call GetEmployeeName, passing the object to it.
Assign the private member EmpName to the global pointer.
Return the pointer to main.
Show what the pointer is pointing at (for example cout<< *GlobalPointer <<
endl;)
any refinements would be great. Remember this is an example of what not to
do (returning pointers to private members). I have trouble putting the
string in to the object's data member, so I could do with some help!
_________________________________________________________________
Protect your PC - get McAfee.com VirusScan Online
http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
|