Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Product {
- Postachalnik obj;
- char* product;
- int count;
- float price;
- public:
- Product();
- Product(char*, int, float, Postachalnik&);
- Product(Product&);
- ~Product();
- void PrintFull();
- };
- Product::Product() {
- product = new char[8];
- strcpy(product, "no name");
- count = 0;
- price = 0;
- Postachalnik firma;
- }
- Product::Product(char* NameToAdd, int CounttoAdd, float PriceToAdd, Postachalnik& ObjectToAdd) {
- product = new char[strlen(NameToAdd) + 1];
- strcpy(product, NameToAdd);
- count = CounttoAdd;
- price = PriceToAdd;
- obj = ObjectToAdd;
- }
- Product::Product(Product& a) {
- product = new char[strlen(a.product) + 1];
- count = a.count;
- price = a.price;
- obj = a.obj;
- }
- Product::~Product() {
- delete product;
- obj.~Postachalnik();
- }
- void Product::PrintFull() {
- std::cout << product << '\t' << count << '\t' << price << '\t';
- obj.PrintFull();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement