It seems the linker thinks that my member function isn't defined, when it actually is.
The Problem:
I have a non-template member function call
Price( ), which returns the price of the item; no surprise there. It's declared within the
Database_Item structure. This structure inherits from
Database_Item_Base with no conflicting names. Here's the declaration of
Database_Item::Price( ):
1 2
|
U_Int &Price( );
const U_Int &Price( ) const;
|
The definition of these member functions are defined within a separate source file, which contains all definitions of
Database_Item_Base and
Database_Item.
Here's what I've tried so far:
1) Made sure all dependant files are included into the project
2) Made sure all object files are up-to-date
3) Made sure there's an actual definition
4) Made sure the declaration signature matches the corresponding definition
5) Made sure the directory to the source files is set (including headers)
6) Made sure the source (where the definitions are) includes the declarations
If it helps, here are the declarations of both structures:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
|
//
// I T E M B A S E
//
struct Database_Item_Base
{
Database_Item_Base( );
Database_Item_Base( const Database_Item_Base &Item );
Database_Item_Base( const U_Int &New_ID, const char *New_Name );
protected:
//
// D A T A M E M B E R S
//
U_Int Base_ID_;
const char *Base_Name_;
public:
//
// M E M B E R F U N C T I O N S
//
virtual U_Int &ID( );
virtual const U_Int &ID( ) const;
virtual const char *&Name( );
virtual const char * const &Name( ) const;
};
//
// I T E M
//
struct Database_Item : public Database_Item_Base
{
Database_Item( );
Database_Item( const Database_Item &Item );
Database_Item( const U_Int &New_Price );
private:
//
// I N H E R I T E D M E M B E R S
//
using Database_Item_Base::Base_ID_;
using Database_Item_Base::Base_Name_;
//
// D A T A M E M B E R S
//
U_Int Price_;
public:
//
// I N H E R I T E D M E M B E R F U N C T I O N S
//
using Database_Item_Base::ID;
using Database_Item_Base::Name;
//
// M E M B E R F U N C T I O N S
//
U_Int &Price( );
const U_Int &Price( ) const;
//
// O P E R A T O R S
//
Database_Item &operator << ( std::ostream &Stream );
const Database_Item &operator << ( std::ostream &Stream ) const;
};
|
It's just
Database_Item::Price( ) that causes the error; nothing else.
Thoughts?
Wazzak