Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.94 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. class Address {
  5. private:
  6.     char* name;
  7.     char* street;
  8.     int number_house;
  9.  
  10.     //constructors & destructor
  11. public:
  12.     Address (char* name, char* street, int number_house);
  13.     Address();
  14.     Address(const Address&);
  15.     ~Address();
  16.  
  17.     //Set & Get
  18.  
  19.     void Set_name (char* name);
  20.     void Set_street (char* street);
  21.     void Set_number_house (int number_house);
  22.     char* Get_name ();
  23.     char* Get_street();
  24.     int Get_number_house();
  25. };
  26.  
  27. Address :: Address (char* name, char* street, int number_house) {
  28.     this -> name = name;
  29.     this -> street = street;
  30.     this -> number_house = number_house;
  31.     cout << "Конструктор с параметрами вызван для объекта " << this -> name << endl;
  32. }
  33. Address :: ~Address() {
  34.     cout << this -> name << " объект уничтожен" << endl;
  35. }
  36.  
  37.  
  38. int main() {
  39.     char* x = "Aleksey";
  40.     char* y = "SS";
  41.     Address *test = new Address(x, y, 5);
  42.     return 0;
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement