All pastes #474938 Raw Edit

Unnamed

public text v1 · immutable
·published 2007-05-07 03:00 UTC
rendered paste body
template <class T>
class PaluObjectDatabase
{

      private:
              
              vector<T*> object_list;
              
      public:

              void insert(T* object);

};

template <class T>
void PaluObjectDatabase<T>::insert(T* object)
{
     
     this->object_list.push_back(object);
     
}


int main(int argc, char *argv[])
{
    
    PaluObjectDatabase<PaluItem*> test_database;
    
    PaluItem *a = new PaluItem(21, "Potion");
    PaluItem *b = new PaluItem(36, "Bandage");
    
    test_database.insert(a);
    //test_database.insert(b);
    
    system("PAUSE");
    return EXIT_SUCCESS;
}

error:

 F:\Programming\Prototypes\Inventory\main.cpp In function `int main(int, char**)': 
17 F:\Programming\Prototypes\Inventory\main.cpp no matching function for call to `PaluObjectDatabase<PaluItem*>::insert(PaluItem*&)' 
 note F:\Programming\Prototypes\Inventory\PaluObjectDatabase.hpp:35 candidates are: void PaluObjectDatabase<T>::insert(T*) [with T = PaluItem*]
 F:\Programming\Prototypes\Inventory\Makefile.win [Build Error]  [main.o] Error 1