#C++ Project(urgent help needed) for parameterized constructor

1 messages · Page 1 of 1 (latest)

wanton sandal
#

Im trying to turn Implement a parameterized constructor that takes the name of the input file as a reference to string argument. The constructor will read the input file, where each line corresponds to a Book subclass and dynamically allocate Book-derived objects with the information read from the input file and add them to the LibraryRecord.
Also to implement LibraryRecord::displayFilter that takes a reference to string key and displays information of its holdings whenever they key matches the relevant information (specific to the type of book). https://wandbox.org/permlink/RujRlaT7ZX9zcx7j

nocturne iglooBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question run !howto ask.

wanton sandal
#

@loud current Prayge

dense jetty
#

what is your question?

wanton sandal
#

how can I implement a parameterized constructor that takes the name of the input file as a reference to string argument for LibraryRecord.cpp

#

Im also trying to read a csv file

#

i figured to use ifstream

#

but uhh

#

j,

#

hmm

dense jetty
warm harbor
#

a constructor is more or less just a function with the same name as a the class it's in

#

otherwise function params work the same as other functions

#

so, do you know how to write functions?

wanton sandal
#

uh

#

any function?

warm harbor
#

basically yes

wanton sandal
#

huh

warm harbor
#

I more mean the understanding of what they are, how they work, how to write them, how to use them

wanton sandal
#

im just

#

lost

#

I thought I knew how

#

havent messed around with fstream and sstream in a whinle

#

while

warm harbor
wanton sandal
#

all I know

#

is that I have to change book to be come a pointer

#

rather than the template by itself

#

and im not streaming in all the values of the csv file

#

because somehow the book type is the last value

#

but i have no clue how to fix that

warm harbor
#

it helps to ask a specific question and define the problem rigorously

#

you've asked a rather broad question that you would mostly know the answer to if you review the chapter on functions

#

Also to implement LibraryRecord::displayFilter that takes a reference to string key and displays information of its holdings whenever they key matches the relevant information (specific to the type of book).
this isn't specific enough, like I wouldn't be able to take this description and write code for it, at least not code that actually meets whatever the requirements actually are

#

even if we could write the code for it, doing it for you would be against Rule #5 of the server

#

I will note that it's a good positive indicator that you seem to almost know how to use wandbox well, like with multiple files and stuff, and that's great

#

but... it doesn't compile, you're missing some sources and you have a bunch of irrelevant ones

#

also missing the CSV data file