Just a quick question, I am working with classes and I was trying to rename one as an array, ie:

addressType addresses[n];

But I have decided not to make it an array. So is this a legal statement?

addressType addresses;

Or does that only work for arrays? Thanks

Recommended Answers

All 6 Replies

depends on what addressType is defined to be.

#ifndef H_addressType
#define H_addressType

#include <string>
#include <fstream>

using namespace std;

class addressType
{
public:
	void setAddressInfo(string street, string city, string state, string zip);
	void print(ostream& outF);
	void showAddress();
	void editStreet( string street);
	void editCity(string city);
	void editState(string state);
	void editZip(string zip);
	addressType(string street ="", string city = "", string state = "", string zip = "");
	string getStreet();
	string getCity();
	string getState();
	string getZip();
private:
	string streetAddress;
	string cityName;
	string stateName;
	string zipCode;
};

#endif

Then this goes into a personTyple class. I am building an address book.

Just a quick question, I am working with classes and I was trying to rename one as an array, ie:

addressType addresses[n];

But I have decided not to make it an array. So is this a legal statement?

addressType addresses;

Or does that only work for arrays? Thanks

That looks fine to me. Should work. Code tag is this:

[code=cplusplus] // code

[/code]
not

[code = cplusplus] // code

[/code]

code=cplusplus is all one word, no spaces.

Thanks;

I hope it is ok just to keep this in this thread. I have another question now.

I am getting a debug assertion failed message. It reads:

Program...chool\Basic Programming\Practice\Programs\mod5\Debug\mod5.exe
File f:\dd\vctools\crt_bld\self_x86\crt\src\memcpy_s.c
Line 62

Expression: SizeInBytes >= count

.....

Any idea what this means?

You are probably trying to copy memory to a destination which is too small in size.

At the time that assertion fails, you may find the offending piece of code by viewing the call stack.

Thanks, I had a "-" where I should have had a "+". When I saw the "f:" next to file I assumed it had something to do with my external hd, thanks guys.

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.