hi, I'm creating a program that takes data http://football-data.co.uk/mmz4281/1415/E0.csv
ad so far have removed the data i don't want, and want to use inheritance to use a base class and create sub-classes when a team name is read.
is it possible?
can i use something like
name_of_file.getline(home_team, 20,',');
//then create a subclass by:
class "pointer to home team??" : public base_class
That's not possible. The input string will be a value in a variable, no way to transfer that to a variable name. You could put the value inside the class as a string member.
What shadowCODE posted is your best bet for doing that. You can't create a class object using a string to name that class object (and for good reason; imagine if you had Patriots, Colts, and Steelers as sub classes derived from the base class - the problem would then be you can't use those class objects since your program doesn't know what they are called), but you can store the name of the team within an object as a string member as suggested.