Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- class Address {
- private:
- char* name;
- char* street;
- int number_house;
- //constructors & destructor
- public:
- Address (char* name, char* street, int number_house);
- Address();
- Address(const Address&);
- ~Address();
- //Set & Get
- void Set_name (char* name);
- void Set_street (char* street);
- void Set_number_house (int number_house);
- char* Get_name ();
- char* Get_street();
- int Get_number_house();
- };
- Address :: Address (char* name, char* street, int number_house) {
- this -> name = name;
- this -> street = street;
- this -> number_house = number_house;
- cout << "Конструктор с параметрами вызван для объекта " << this -> name << endl;
- }
- Address :: ~Address() {
- cout << this -> name << " объект уничтожен" << endl;
- }
- int main() {
- char* x = "Aleksey";
- char* y = "SS";
- Address *test = new Address(x, y, 5);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement