I have different objects that can be produced. Each object type has different costs. I want to check whether the user can afford a specific object **BEFORE** creating it. The following approach does not respect this requirement: 

```
class Costs {
public:
    int oneCost, anotherCostAttribute; // Actual values for both attribute may differ for the objects
}

class Object {
public:
    virtual Costs getCosts() = 0;
} 

class Object_A : public Object {
    // implement getCosts (always the same for all A's)
}

class Object_B : public Object {
    // implement getCosts (always the same for all B's)
}

// Usage:
// I would have to create a specific object just to check the costs:
Object* pObj = new Object_A();
if(avilableResources >= pObj->getCosts()) {
   // Store object, otherwise delete it
}

```

My second idea was some kind of base class which offers a virtual static function, but this is not possible with C++:

```
class Object {
public:
    virtual static Costs getCosts() = 0;
} 

```

Just using a static *Costs* attribute would not allow to distinguish sub class costs:

```
class Object {
public:
    static Costs m_costs; // All objects (A,B,...) would cost the same
} 

```

What would be a proper way to directly associate the costs to the objects?