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
|
Class A : public B
{
public:
void Initialise(void);
void GetCost( const CostType & cost ) const;
protected:
double* pCost;
};
void A::Initialise(void)
{
double iniCost[12] = { 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0 };
pCost = iniCost;
}
void GetCost( const CostType & cost ) const
{
double updatedCost[12] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
updatedCost = cost; // error as well
pCost = updatedCost; // error: assignment of data-member ‘A::pCost’
}
| |