Observe the following interface / implementation:
properties.h
class Property
{
public:
Property(PropertyCollection * propertyCollection, std::string key,
std::string value, uint32_t identifier);
properties.cpp
Property::Property(PropertyCollection * propertyCollection,
std::string key, std::string value, uint32_t identifier = 0)
: propertyCollection(propertyCollection), key(key), value(value),
identifier(identifier) {}
As you can see, I have a default initializer for the last argument.
However, I still get this Eclipse error:
main.cpp
Properties properties (*file);
Property property (&properties, std::string("Cats"), std::string("Rule"));
there is no corresponding function to call "Property :: Property (Properties *, std :: string, std :: string)
EDIT: Propertiesinherited from PropertyCollection. PropertyCollectionis a pure virtual class.
+----------------------+
| <<pure virtual>> |
| PropertyCollection |
+----------------------+
| |
+----------------------+
^
|
+
+-----------------------+
| Properties |
|-----------------------|
| |
+-----------------------+
In Java, I would think of Properties* how * PropertyCollectionand just pass the as-is link. However, in C ++, should I somehow pointer over the base class?
Edit: not necessary. The only problem was the default initializer location.