I have created a pointer p of class A type after moving the pointer also I am able to make a call to class A function.
Looking for a proper explanation of this
class A {
public:
void print() {
std::cout << "hello";
}
};
int main() {
std::shared_ptr<A> p ( new A);
auto p2 = std::move(p);
p->print();
}
Aucun commentaire:
Enregistrer un commentaire