Hello, I made a class and now I want to store instances of those classes in an array. I looked it up and found it was as easy as:

className arrayName[x]

When I tried that I got this error:
error: no matching function for call to 'archerTower::archerTower()'|

My class:

// class
class archerTower{
    float cX;
    float cY;
    float radius;
        float getcX(){return cX;}
        float getcY(){return cY;}
        float getRadius(){return radius;}

archerTower::archerTower(float x, float y, float r)
    cX = x;
    cY = y;
    radius = r;

And finally when I try to create the array:

archerTower archerTowerArray[4];

Can anyone please help me?

To create an array of objects without initialization, the object type must have a default constructor. The rule in C++ is that a default constructor is generated for you if you don't explicitly define any constructor explicitly. Your class has a three parameter constructor, so no default constructor is generated automatically. You need to do it explicitly.

This question has already been answered. Start a new discussion instead.