C++ error: "size" declared as function returning a function -


i'm not sure why getting error during compilation says "error: "size" declared function returning function" when size() returning type size_t. appreciated, thanks.

// text.h #include <cstring> #include <fstream> #include <iostream> using namespace std;  namespace w3 {     class text {         string* arrayrecords;         size_t numrecords;     public:         text();         text(const char* filename);         size_t size() const;         ~text();     }; }  // text.cpp  #include "text.h"  namespace w3 {     text::text() {         numrecords = 0;         arrayrecords = nullptr;     }      text::text(const char* filename) {         //     }      size_t text::size() const() {         return numrecords;     }      text::~text() {         if(arrayrecords)             delete [] arrayrecords;     } } 

the problem line:

size_t text::size() const() 

remove () after const, have:

size_t text::size() const 

Comments

Popular posts from this blog

1111. appearing after print sequence - php -

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

Ruby on Rails, ActiveRecord, Postgres, UTF-8 and ASCII-8BIT encodings -