Luxana
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","stri ng3"}
dataArray[2] = {"string4","string5","stri ng6"}
Can anyone push me forward a bit? :-) please ask me question if my scenario is unclear to you.
thank you
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","stri
dataArray[2] = {"string4","string5","stri
Can anyone push me forward a bit? :-) please ask me question if my scenario is unclear to you.
thank you
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.