C++ 如何实施<&书信电报;及>&燃气轮机;为指针?

C++ 如何实施<&书信电报;及>&燃气轮机;为指针?,c++,pointers,C++,Pointers,我需要让“”为指针工作,因为我在下面为我的主驱动程序编写了代码 int main() { using namespace std; cout << "Welcome to My TrashCan Program!" << endl; TrashCan myCan; TrashCan yourCan; TrashCan empty( 0, 0 ); TrashCan * ptrCan = new TrashCan( 0, 0 ); TrashCan * nullCan

我需要让“”为指针工作,因为我在下面为我的主驱动程序编写了代码

int main()
{
using namespace std;


cout << "Welcome to My TrashCan Program!" << endl;

TrashCan myCan;
TrashCan yourCan;
TrashCan empty( 0, 0 );
TrashCan * ptrCan = new TrashCan( 0, 0 );
TrashCan * nullCan = NULL; // pointer to null

// using pointers here
cin >> ptrCan;
cin >> nullCan;  // 

cout << ptrCan << endl;
cout << nullCan << endl;  //
return 0;}
intmain()
{
使用名称空间std;
cout-ptrCan;
cin>>nullCan;//

cout从
cin
读取指针几乎永远不会起作用。这就是为什么默认情况下该语言不允许您使用的原因。类似于:

cin >> ptrCan;
如果允许的话,会丢失您从新垃圾桶(0,0);
几行之前得到的物体的轨迹(即泄漏)


请解释您真正想做的事情。

cin
读取指针几乎永远不会起作用。这就是为什么默认情况下该语言不允许您使用的原因。类似于:

cin >> ptrCan;
如果允许的话,会丢失您从新垃圾桶(0,0);几行之前得到的物体的轨迹(即泄漏)


请解释您真正想做的事情。

技术上不允许您这样做。我们到底在输入什么,然后加载到指针中。地址?技术上不允许您这样做。我们到底在输入什么,然后加载到指针中。地址?