Assuming a simple class like below and the main like below, will the class variable be stack/heap allocated depending on how the class is instantiated? OR will the class variable be allocated depending on how it is implemented?
class Foo
{
private:
std::string Bar;
public:
Foo() : Bar(std::string()) {}
};
int main()
{
Foo* F = new Foo(); //Will Bar be allocated on the heap because of new? OR does Bar have to be std::string*
Foo G = Foo(); //Bar will be allocated on the stack right?
}