I want to make a separate class for shop stuff rather than stuff my whole game in one class but it would probably be way easier to just nest all the shop functions in the already existing inventory class so I can directly change the required variables rather than need to put the variables into the separate class functions as parameters.
That sort of sounds like you're passing references around to internal class variables and letting other classes edit them directly. That is not how you're meant to do it.
It might sound "easier" to do everything as one class because they can directly edit the variables, but it's really not any easier from a programming point of view. Typing up class and function headers is trivially quick to do.
Trying to rewrite shop code that's directly embedded in your inventory class would be a slow and laborious task. Say you wanted two types of shop later. Are you going to double-up on the shop code now? Since it's hard-coded you'd have to duplicate all your buy and sell commands and manually edit what they buy and what they cost.
Whereas if you wrote them separate from the start and created some sort of struct for a "sale item" (including cost and what you get), then adding new sale items and new shops would take a couple of seconds to create. You'd make a struct for a sale item something like this:
struct sale_item
{
string text, description;
int cost;
item_type item; // item_type would be an enum used by the inventory class
int amount;
sale_item(string _text, int _cost, item_type _item, int _amount, string _description):
text(_text), description(_description), cost(_cost), item(_item), amount(_amount)
{}
}
^ text would be the menu label, description a detailed text that you get when you're over the item, cost is the cost in gold, "item" is a reference to the item type you get and amount is how much you get.
You could then implement shops as just an array of sale_item objects, and you could used sale_item[0]'s text and description as the name / description of the shop. Because I included a constructor you can just write the shop as a table like this example ...
sale_item food_shop[] =
{
sale_item("Food Shop", 0, item_null, 0, "A shop that sells food"),
sale_item("Bread", 5, item_bread, 8, "8 bread rolls"),
sale_item("Meat", 15, item_meat, 4, "4 chunks of meat")
};
That will do the job, then you just have to write some menu code to display the shop things and let you pick stuff, and code to send changes to the inventory class. The code is pretty compact and clean and you can edit the needed things as data now.