You are here:

C++/c++ question


hi Alan:

i am to write a program to read data containing the name, address, telephone number, and class of a friend into an object and print its contents.
now, i understand class and how to write a class, but i am lost on writing into an object.

Sorry for the delay in my response. Midterms last week were pretty killer. Anyway objects are more of a descriptive term as oppose to an actual piece of code. A class has objects in it, for example, but those objects could be an array, a vector, a struct, etc. You have to think in more generic terms when it comes to object oriented programming. You have to think 'high level'. So instead of declaring an array with a pre-determined size of 6 positions, you'd declare the array, but have either the user input how many positions they want, or just keep pushing new inputs onto the back of the array and expand it as needed. A class can also be considered an 'object', as classes are an important part of object oriented programming. I would just write a class that can do everything you need it to do. Just try to make it as high level as possible with no pre-defined variable lengths (such as the array example earlier). I hope this helps. If you need any clarification please let me know.

Best Of Luck,


All Answers

Answers by Expert:

Ask Experts


Alan F.


Having problems with any basic or intermediate parts of C++? I can answer those questions for you using simple English. I have been taking C++ in school for a couple years, so I still remember what it was like to be a beginner (especially with C++, which is a difficult language)!


I have a C++ web page that discuses the basics of C++. The address is:

©2016 All rights reserved.