dimanche 27 juin 2021

What is const & method in C++

I saw code like that.

What this & means and what is the official name of this kind of methods?

struct S{
    int get() const &{
        return 5;
    }
};

int main(){
    S s;
    return s.get();
}

Aucun commentaire:

Enregistrer un commentaire