mercredi 20 mai 2020

Do functions go to the heap or stack if the class is on the heap?

class Foo{

    public:
        void foo(){
            int x, y; // go to the HEAP or the stack?
        }
};

int main(){
    Foo *f = new Foo();
    f -> foo();

    delete f;
}

if I create a class instance on the HEAP and activate a "class method" where is the function local variables and "metadata" stored? on the HEAP because the class is on the HEAP or the stack?

Aucun commentaire:

Enregistrer un commentaire