小编Dar*_*ord的帖子

释放一个对象数组?

我有一些问题需要释放我所拥有的类的数组.下面是Class,一个简化的实现和我试图用来关闭它的代码.

人物类

#include <cstdlib>


class Character
{
   private:

            bool human;
            int Xposition;  // the character's postion on the board.
            int Yposition;  // the character's postion on the board.
            bool alive;


   public:

            Character();        //This is my constructor
            ~Character();       //This is my destructor
            bool isHuman();     //return whether type 1 aka Human
            bool isZombie();    //return whether type 2 aka Zombie
            void setHuman();    //set to type 1 or Human
            void setZombie();   //set to type 2 or Zombie
            void setPos(int xpos, int ypos);        //set the …
Run Code Online (Sandbox Code Playgroud)

c++

1
推荐指数
2
解决办法
1276
查看次数

标签 统计

c++ ×1