samedi 17 août 2019

Can i access the memory of a pointer without using new operator

In my following code would this line will be valid

*thisItem = *currentItem;

Container cont;
TreeItem *thisItem = new TreeItem( &cont);  

TreeItem *currentItem = reinterpret_cast<TreeItem *>(nodePtr);
*thisItem = *currentItem; // Is this valid

Aucun commentaire:

Enregistrer un commentaire