c++ - 尝试从另一个 .cpp 启动 TShape 时成员标识符预期错误

标签 c++ oop c++builder

所以,我正在尝试在派生文件中创建和初始化 TShape 对象,我得到了预期的 E2280 成员标识符。 这是代码

#include "Data.h"
#include "MainWindow.h"
#include <vcl.h>
class item{
public:
    TShape *Forma;
    TImage *Imagine;
    TLabel *Denumire, *Set, *Stat, *Price, *Weight, *Effect, *Type, *ID;
    TButton *Equip;
    item(int k);
};

item::item(int k){
    int pozitia_forma=k*130+5;
    Forma->new TShape(MainWindow_Form);
    Forma->Parent=MainWindow_Form->ScrollBox;
    Forma->Height=130;
    Forma->Width=370;
    Forma->Top=pozitia_forma;
    Forma->Left=5;
}

最佳答案

语法错误:

Forma->new TShape(MainWindow_Form);

看来你需要

Forma = new TShape(MainWindow_Form);

关于c++ - 尝试从另一个 .cpp 启动 TShape 时成员标识符预期错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23088973/

相关文章:

c++ - 构建项目包C++ Builder

static-libraries - 如何将 64 位 COFF 转换为 OMF?

java - 覆盖java子类中的参数化构造函数

php - 依赖注入(inject)还是范围解析运算符?

c++ - 从 STL 集派生

c++ - 嵌套迭代器类、begin() 和 end() 哨兵问题

c++ - 缓存单个重写计算 C++11

c++ - 如何通过双击处理文件打开,同时拒绝多个实例

c++ - 错过了虚函数调用

c++ - 如何随机输出两个字符串之一?