bst class and constructors:
Code:template<class Item, class Key> class bst { public: Item item_value; bst* left_tree; bst* right_tree; Key key_value; bst<Item, Key> *catchall; typedef void (*Process)(); typedef int Param; bst(); bst(Item item, Key key); ... template <class Item, class Key> bst<Item, Key>::bst(){ studentRecord record; item_value = record; } template <class Item, class Key> bst<Item, Key>::bst(Item item, Key key){ item_value = item; key_value = key; left_tree = NULL; right_tree = NULL; }
studentRecord class and create_database function:
implementation of create_database();Code:in studentRecord.h #ifndef BST_H #define BST_H using namespace std; struct course{ int num; int cred; char grade; }; class studentRecord{ public: template<class Item, class Key> bst<studentRecord, int>* create_database();
and my main file:Code:in studentRecord.cxx template<class Item, class Key> bst<studentRecord, int>* studentRecord::create_database() { bst<studentRecord, int> blank; bst<studentRecord, int> *root; int num_courses = 0; int count = 0; string str; while(true) { getline(cin, str); if (str == ".")break; else blank.id = atoi(str); blank.key_value = blank.id; getline(cin, blank.name); getline(cin, blank.major); cin >> num_courses; for (int j = 0; j < num_courses; ++j) { cin >> blank->courses[j].num; cin >> blank->courses[j].cred; getline(cin, blank->courses[j].grade); } insert_node(blank, blank.key_value, blank.item_value); for(count; count < 1; count++) { root = ␣ } } return root; }
and finally the error i am currently getting:Code:#include "studentRecord.cxx" using namespace std; int main( ) { bst<studentRecord, int> *mydb; studentRecord myrecord; mydb = mydb->item_value::create_database(); ...
Code:studentExam.cxx:15: error: cannot convert `studentRecord' to ` bst<studentRecord, int>*' in assignment




Reply With Quote