Hello,
I have a question about classes on C++.
So far I have 3 classes on my project. BibEntry ( abstract class), KeyFinder (class to find the \cite in file and store to private KEY at abstract) and TypeFinder ( class to find which entry is it article, journal so on )
overloaded ifstream in KeyFinder will find the key in .tex file and use the method setKey from abstract class to store it
overloaded ifstream in Type Finder will find the type from the key obtained from abstract class.
I had this snippet on main function
BibEntry *entry = 0;
KeyFinder key;
TypeFinder type ;
infile1 >> key;
infile2 >> type;
entry = &key;
cout<<entry->getKey()<<endl;
entry = &type;
cout<<entry->getKey()<<endl;
MY QUESTION IS : How come when I call key.getKey the searched key appears on display but type.getKey won't appear on display. Also, why is it that during the overloaded stream for TypeFinder the command type.getKey appears empty?
Both my classes inherit from abstract class so both of them should have access to private data KEY in abstract class. I'm very confused. I tried casting it to (TypeFinder) key but compiler didn't allow.
What can I do so that both TypeFinder and KeyFinder can access the same Key that the stream over loader had set ?
I attached all my files for your convenience. please remove the .doc extension for the input files.