Task :
Build a description of the class that contains information about the postal address of the organization. Provide for the possibility of separate changes to the components of the address, the creation and destruction of objects of this class. Write a program demonstrating how to work with this class. The program must contain a menu that allows you to check all the methods of the class.
Question :
How to make the creation and deletion of class objects? As I understand the condition, you need to make the creation and deletion of objects at the request of the user.
#include <iostream> #include <string> using std::string; class Mail { private: string zipcode; string city; string street; string room; public: Mail(string zip_ = "00", string city_ = "City", string street_ = "Street", string room_ = "0"); void ChangeZip(string & zip_); void ChangeCity(string & city_); void ChangeStreet(string & street_); void ChangeRoom(string & room_); void showmail() const; ~Mail() { }; }; Mail::Mail(string zip_, string city_, string street_, string room_) { zipcode = zip_; city = city_; street = street_; room = room_; } void Mail::ChangeZip(string & zip_) { zipcode = zip_; } void Mail::ChangeCity(string & city_) { city = city_; } void Mail::ChangeStreet(string & street_) { street = street_; } void Mail::ChangeRoom(string & room_) { room = room_; } void Mail::showmail() const { std::cout << zipcode << std::endl << city << std::endl << street << std::endl << room << std::endl; }
Mail* mail = new Mail();anddelete mail;- acadeMail mail();) - the object will be destroyed when it goes out of scope. - acadeMail mail();onlyMail mail();- this is a function declaration. : P - HolyBlackCatMail mail{}. - acade