0
메인에 내 드라이버에 대해 아래 코드화 된대로 '< <'및 '>>'을 포인터로 사용해야합니다.포인터를 구현하는 방법 << and >?
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;}
임 어디 선가 이러한 기능을 구현해야하지만, 아주 확실하지 않다 것이라고 가정하는 방법 :
friend std::ostream& operator <<(std::ostream& outs, const TrashCan * drive);
friend std::istream& operator >>(std::istream& ins, TrashCan * & drive);
기술적으로 허용되지 않습니다. – chris
우리가 정확히 무엇을 입력하면 포인터에로드됩니다. 주소? – Radnyx