I get an error when dynamically creating an array of a (transaction) object. The error output says:"no matching function for call to 'Transaction::Transaction()' This is part of an assignment and we are not allowed to use a default constructor. From what I gather an array automatically assigns values to each of its indexed address when it's created and as no default constructor is made for Transaction, it cannot do this without values. Please help me see what I could do to fix this error.
class Transaction
{
private:
int id;
float amount;
string fromAddress, toAddress, signature;
bool confirmed, removeFromPool;
static int numTransactions;
public:
Transaction(string in_fA, string in_tA,string in_sign,float in_amount);
Transaction(Transaction &obj);
int getId() const;
}
//---------------------
class Block
{
private:
int id, txCount;
const int MAX_TX=5;
Transaction** txList;
string blockHash, prevBlockHash, minerName;
bool confirmed;
public:
Block(int id,string prevH,string name);
}
//------------------
// block.cpp
Block::Block(int i, string prevH, string name)
{
*txList = new Transaction[MAX_TX];
}