I am learning c++. I am tring to make a couple of objects inside another object but compiler is giving error - no matching function for call to 'Grass::Grass()' .
This is the header file of "world" object. In it I declared two "grass" objects :-
#ifndef WORLD_H
#define WORLD_H
#include "Grass.h"
using namespace std;
class World
{
public:
World();
private:
Grass g1;
Grass g2;
};
This is the cpp file of the "world" object. In the constructor I tried to make the "grass" objects but failed.
#include "World.h"
#include <iostream>
using namespace std;
World::World()
{
g1(200, 200);
g2(300, 200);
}