dimanche 19 janvier 2020

C++ data members: Value vs. Pointer [duplicate]

I am beginning development on a substantial personal project and wanted to ask a question regarding data members before doing so.

I am cognizant of the big differences between references and pointers. However, in my recent research, I have not found much (if any) clarification on the differences between data member values and pointers.

Consider the following two class definitions:

class A
{
private:
    const std::string someString_;
};

class B
{
private:
    const std::string *someString_;
};

What are the differences/nuances between the member data of classes A and B? Informed answers and relevant articles would be highly appreciated.

Aucun commentaire:

Enregistrer un commentaire