Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Пример деструктора, который освобождает выделенную динамически память.
- #include <iostream>
- using namespace std;
- #include <string.h>
- //////////////////////////////
- struct Man
- {
- int nOld;
- float high;
- };
- //////////////////////////////
- class T
- {
- public:
- //=====
- Man CMan;
- char szAddress[199];
- char szCityName[99];
- char szStreetName[99];
- int nNumbHouse;
- int nNumbAppart;
- //---------
- T();
- };
- T t1;
- ////////////////////////////////////////////////////////
- int main() //
- {
- strcpy(t1.szCityName, "Piter");
- cout << "szCityName = " << t1.szCityName << endl;
- cout << "szStreetName = " << t1.szStreetName << endl;
- cout << "CMan.nOld = " << t1.CMan.nOld << endl;
- cout << "CMan.high = " << t1.CMan.high << endl;
- return 0;
- }
- ////////////////////////////////////////////////////////////////////
- T::T() //
- {
- strcpy(szCityName , "NoName City" );
- strcpy(szStreetName, "No Street");
- CMan.nOld = 21;
- CMan.high = 1.73;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement