我写;
Element element=new Element;
我有错误;
homework.cpp: In function 'int main(int, char**)':
homework.cpp:227:29: error: conversion from 'Element*' to non-scalar type 'Element' requested
*** 1 errors, 0 warnings
我不想要一个指针或元素数组,
我应该写Element *element= new Element;
。有人解释一下吗?
编辑:
元素类:
class Element{
public:
Element():exists(false){};
std::string name;
std::string full_path_name;
ElementType element_type;
long element_size;
bool exists;
};