class Account
{
protected:
char* Account_Holder;
int Amount;
public:
Account();
Account( char* Holder, int Num );
Account( Account &obj );
};

Account::Account()
{
Account_Holder = NULL;
Amount = 0;
}
Account::Account( char* Holder, int Num )
{
Account_Holder = Holder;
Amount = Num;
}
Account::Account( Account &obj )
{
Account_Holder = obj.Account_Holder;
Amount = obj.Amount;
}

There is nothing wrong with your code.

I added this to test it in the debugger:

int main(void)
{
	auto Account act1;
	auto Account act2("fred", 2);
	auto Account act3(act2); // copies act2
	
	/* ...if member variables are public, try this:
	printf("%d\n", act1.Amount);
	printf("%d\n", act2.Amount);
	printf("%d\n", act3.Amount);
	*/
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.