class Print
{
public:
void PrintAll() {}
private:
std::list<int> mylist;
};
Run Code Online (Sandbox Code Playgroud)
我从C++语言书中看到了这个示例问题.我想打印内部的mylist元素.如果需要反转mylist,使用C++ STL库并使用输出结果,怎么办呢?
非常感谢你!
class Foo
{
public:
Foo() { x = new int; }
~Foo() { delete x; }
private:
int *x;
};
Foo *p = new Foo[10];
free ( p );
Run Code Online (Sandbox Code Playgroud)
我对上面的代码感到困惑.它有什么问题吗?