#include <iostream>
#include <memory>
class test
{
private:
int x , y;
public:
test(int a , int b):x(a),y(b){}
void fun()
{
std::cout<< x<<" "<<y<<" "<<std::endl;
}
};
void show(std::auto_ptr<test> t1)
{
t1->fun();
}
int main()
{
show(new test(3,4));
}
我收到一個編譯錯誤,請告訴我這段代碼有什麼問題?提前致謝。當auto_ptr是它的參數時如何調用函數!
你是絕對正確的! – Alok 2011-06-17 02:51:34