my first oop based program

This is a discussion on my first oop based program within the C++ Programming forums, part of the General Programming Boards category; i'd like to know how to make the same pointer points to differents types of vars,
if you read the ...

You'll get to change one thing about him before you meet him, which is exactly how your program seems to work now.

There's nothing particularly object oriented about this, anyway, but it is rather strange that person is a class that exposes its data to the rest of the program. The code sample doesn't need to be found in a main() function. I could change the details of a person anywhere, and in any way I wanted.

My advice for the program is to throw it away. My advise for you is to learn more about OOP. There are no shortage of tutorials (or entire books), just STFW.

You can't do it your way since the data aren't all the same type. You could do it your way with a more advanced technique, but then, what is the point?
bithub's example is easier, so I'd suggest you use that instead.

Make sure you've also got #include <string> in addition to the <iostream> header. Your implementation may pull in the necessary header for the string object to work but you really do not want to rely on this. Since you're using string containers, include the string header.

void introduce(person person)
{
cout<<"\nHi, my name is "<<person.name<<". I'm a "<<person.age<<" years old "<<person.sexString()
<<", and I live in "<<person.country<<"."<<endl;
cin.get();
}

When passing objects into function, prefer to use a reference parameter. Also, since the function does not do anything to alter the member variables of the passed in object, it should be passed in as const:

Code:

void introduce(const person& person)
{
cout<<"\nHi, my name is "<<person.name<<". I'm a "<<person.age<<" years old "<<person.sexString()
<<", and I live in "<<person.country<<"."<<endl;
cin.get();
}

"Owners of dogs will have noticed that, if you provide them with food and water and shelter and affection, they will think you are god. Whereas owners of cats are compelled to realize that, if you provide them with food and water and shelter and affection, they draw the conclusion that they are gods."
-Christopher Hitchens