#include <iostream>
#include <string>
using namespace std;
class Clothes; // Forward declaration
class Food {
private:
double price;
string expirationDate; // format dd.mm.YYYY
string category;
public:
// Constructor
Food(double p, string expDate, string cat)
: price(p), expirationDate(expDate), category(cat) {}
// Declare friend class
friend class Shop;
};
class Clothes {
private:
double price;
string size;
string category;
public:
// Constructor
Clothes(double p, string s, string cat)
: price(p), size(s), category(cat) {}
// Declare friend class
friend class Shop;
};
class Shop {
public:
// Print categories of Food and Clothes
void printCategories(const Food &f, const Clothes &c) {
cout << "Food category: " << f.category << endl;
cout << "Clothes category: " << c.category << endl;
}
// Print total price of Food and Clothes
void printTotalPrice(const Food &f, const Clothes &c) {
double total = f.price + c.price;
cout << "Total price paid: $" << total << endl;
}
};
int main() {
// Create objects
Food apple(2.5, "27.11.2025", "Fruit");
Clothes tshirt(15.0, "M", "Casual Wear");
// Friend class usage
Shop shop;
shop.printCategories(apple, tshirt);
shop.printTotalPrice(apple, tshirt); return 0;
}