Help on dynamic memory function in my account class

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
};

and my implementation of this code is this


#include "accountt.h"



ostream& operator <<(ostream& outs, const account& target)
{
outs << "Account Name: " << target.name << endl;
outs << "Account Number: " << target.ac_number << endl;
outs << "Account Balance: " << target.balance << endl;
}

account::account (char* i_name, size_t i_acnum, size_t i_hsize)
{
assert(strlen(i_name) < MAX_NAME_SIZE);

for(int i = 0; i < strlen(i_name); i++)
name[i] = i_name[i];
for(int j = strlen(i_name); j < MAX_NAME_SIZE; j++)
name[j] = '';
ac_number = i_acnum;
history_size = i_hsize;

history = new string[history_size];
history_count = 0;
balance = 0;
}
account::account( account& ac)
{
for(int i = 0; i < strlen(ac.get_name()); i++)
name[i] = ac.get_name()[i];
for(int j = strlen(ac.get_name()); j < MAX_NAME_SIZE; j++)
name[j] = '';
ac_number = ac.get_account_number();
history_size = ac.get_max_history_size();
history_count = ac.get_current_history_size();
*history = ac.get_history();
balance = ac.get_balance();
}

account::~account()
{
delete [] history;

}
void account::set_name(char* new_name)
{
assert(strlen(new_name) < MAX_NAME_SIZE);
for( int i = 0; i < strlen(new_name); i++)
name[i] = new_name[i];
for( int j = strlen(new_name); j < MAX_NAME_SIZE; j++)
name[j] = '';
}

void account::set_account_number(size_t new_acnum)
{
ac_number = new_acnum;
}

void account::set_balance(double new_balance)
{

balance = new_balance;
}

void account::add_history(char* new_history)
{

if(history_count < history_size)
{

history[history_count] = new_history;

history_count++;
}
}
char* account:: get_name( ) const
{
char* the_name;
the_name = new char[MAX_NAME_SIZE+1];

for( int i = 0; i < strlen(name); i++)
the_name[i] = the_name[i];
for( int j = strlen(name); j < MAX_NAME_SIZE; j++)
the_name[j] = '';
return the_name;
}
size_t account:: get_account_number ( ) const
{
return ac_number;
}
double account:: get_balance( ) const
{
return balance;
}
size_t account:: get_max_history_size( ) const
{
return history_size;
}
size_t account:: get_current_history_size( ) const
{
return history_count;
}

char* account:: get_history( )
{
char *a;
a = new char[history_size];
a = history;
return history;
}

and so pretty much everything works except my get_history() function. it gives me the error cannot convert char* to char** when ran in this program

#include <iostream> // Provides ostream and istream
#include <cstdlib> // Provides ostream and istream
#include "accountt.h"
using namespace std;
//using namespace csci2270_assignmentTwo;

int main( )
{
account a("shiv", 10, 5);
account b("John", 20, 15);
cout << a;
cout << endl;
cout << b;
a.set_balance(100.30);
a.add_history("02/24/11: Deposited $100.30");
cout << a;
a.set_balance(00.30);
a.add_history("02/25/11: Deposited $00.30");
cout << a;
a.set_balance(00.30);
a.add_history("02/25/11: Deposited $00.30");
cout << a;
account c(b);
cout << b;
c.set_name("Jack Smith");
c.set_account_number(201);
c.set_balance(1000000);
c.add_history("first comment");
c.add_history("second comment");
c.add_history("third comment");
c.add_history("fourth comment");
cout << c;
cout << b;
char *n = c.get_name( );
double bl = c.get_balance( );
size_t ac = c.get_account_number( );
size_t chs = c.get_current_history_size( );
size_t mhs = c.get_max_history_size( );

account::string* hs = c.get_history( );
cout << endl << "Account c details:" << endl;
cout << "Name: " << n << endl;
cout << "Account number: " << ac << endl;
cout << "Balance: " << bl << endl;
cout << "Current history size: " << chs << endl;
cout << "Max history size: " << mhs << endl;
cout << "Transaction history: " << endl;
for (int i = 0; i < chs; i++) cout << " " << hs[i] << endl;
delete n;
for (int i = 0; i < chs; i++) delete hs[i];
delete hs;
cout << c;
}

i get this error in line account:: string* hs = c.get_history()

so I am trying to figure out what i am doing wrong any ideas?
Please use [code][/code] tags and post the exact error message
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.
Topic archived. No new replies allowed.