创建类的实例 [英] Create instance of class

查看:72
本文介绍了创建类的实例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

#include "2d/Vector2D.h"
#include <list>
#include "../../AbstTS.h"


class AbstRB;

class fTS: public AbstTS
{

public:

   fTS(AbstRB* owner);

   void       Update();
   void       closestBotStrategy();


};

class fGCBS
{

public:

    fGCBS(AbstRaven_Bot* owner);

    void       pickTarget();
 };


#endif

上面是我的代码,我想从fTS类中的fGCBS类访问pickTarget().我知道我必须创建此fGCBS的实例,但是我不知道如何执行此操作,我们将不胜感激 谢谢你

Above is my code, I want to get access to the pickTarget() from fGCBS class within the fTS class. I know I have to create an instance of this fGCBS but I dont know how to do this, any help is appreciated Thanking You

推荐答案

要创建类的实例,您需要调用其构造函数.

To create an instance of a class, you need to call its constructor.

这篇关于创建类的实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆