1. Engineering
  2. Computer Science
  3. c programming question class address public addressconst stdstringamp street...

Question: c programming question class address public addressconst stdstringamp street...

Question details
C++ programming question

class Address  {  public:   Address(const std::string& street,      const std::string& city,      const std::string& state,     const std::string& zip)     : StreetNumber(street), CityName(city), StateName(state), ZipCode(zip)   {}      std::string GetStreetNumber() const   {    return StreetNumber;   }      void SetStreetNumber(const std::string& street)   {    StreetNumber = street;   }      std::string GetCity() const   {    return CityName;   }      void SetCity(const std::string& city)   {    CityName = city;   }      std::string GetState() const   {    return StateName;   }      void SetState(const std::string& state)   {    StateName = state;   }      std::string GetZipCode() const   {    return ZipCode;   }      void SetZipCode(const std::string& zip)   {    ZipCode = zip;   }     private:   std::string StreetNumber;   std::string CityName;   std::string StateName;   std::string ZipCode;  };

If an array of Address objects, using the class definition above, were to be created using the line below, what would happen?

Address myAddresses[100];
A.

The code would not compile.

B.

An array of 100 Address objects would be instantiated.

C. The compiler would generate the necessary functions to create the objects.

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution