Link to home
Start Free TrialLog in
Avatar of Luxana
LuxanaFlag for Australia

asked on

OOP in C++ and overloaded operators << & >>

Hello

Is there anyone who can answer some questions regarding C++ OOP? What I'm, trying to achieve is that I have class client file with main function which instatiate object from class "fisrtclass":

#include "firstclass.h"

firstclass dataArray[10];

then its opens the file :

in.open(fileName);

and reads from file straight to:

in >> dataArray[count];

-------
At this point I need a hint. How can I futher manipulate data input from this file. For example I need just first three words and so on. How to create overloaded operator>> for firstclass. What I need is that if my file contain:

string1 string2 string3
string4 string5 string6
 
so my:
dataArray[1] = {"string1","string2","string3"}
dataArray[2] = {"string4","string5","string6"}


Can anyone push me forward a bit? :-) please ask me question if my scenario is unclear to you.

thank you









SOLUTION
Avatar of chip3d
chip3d
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial