ok so basically i am trying to implement an account class which uses dynamic array but i am having trouble with a function.
the class specification is this
#include <iostream> // Provides ostream and istream
#include <cstdlib>
#include <string.h>
#include <assert.h>
using namespace std;
class account
{
public:
typedef char* string;
static const size_t MAX_NAME_SIZE = 15;
// CONSTRUCTOR
account (char* i_name, size_t i_acnum, size_t i_hsize);
account ( account& ac);
// DESTRUCTOR
~account ( );
// MODIFICATION MEMBER FUNCTIONS
void set_name(char* new_name);
void set_account_number(size_t new_acnum);
void set_balance(double new_balance);
void add_history(char* new_history);
// CONSTANT MEMBER FUNCTIONS
char* get_name ( ) const;
size_t get_account_number ( ) const;
double get_balance( ) const;
size_t get_max_history_size( ) const;
size_t get_current_history_size ( ) const;
string get_history( ) ;
friend ostream& operator <<(ostream& outs, const account& target);
private:
char name[MAX_NAME_SIZE+1]; //name of the account holder
size_t ac_number; //account number
double balance; //current account balance
string *history; //Array to store history of transactions
size_t history_size; //Maximum size of transaction history
size_t history_count; //Current size of transaction history
};
Bazzy is right, this is incredibly difficult to read as plain text. Saying that, it looks like your assignment statement is incorrect. The get_history() method returns a string. Not a pointer to a string object. Just remove the * and I would think that it would work.