'C++ request for member in , which is of non-class type [duplicate]
I'm probably ignoring some detail, but why can't I call the write method on the object a?
The error is
request for member 'write' in 'a', which is of non-class type 'CFile()
https://onecompiler.com/cpp/3xz85x4ra
class CFile
{
public:
CFile(void); // copy cons, dtor, op=
~CFile (void);
uint32_t write ( const uint8_t *src, uint32_t bytes );
uint8_t *m_Data;
uint32_t m_Len;
uint32_t m_Position;
uint32_t m_Capacity;
private:
};
CFile::CFile(void)
:m_Data(nullptr), m_Len(0), m_Position(0), m_Capacity(0)
{
}
CFile::~CFile (void)
{
delete[] m_Data;
}
uint32_t CFile::write ( const uint8_t *src, uint32_t bytes )
{
...
}
int main (void)
{
uint8_t point[]={1,2,3};
CFile a();
a.write(point, 3);
return 0;
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
