Can you have a member function returning a string in a class?
Hi everyone, is it possible to have a member function that returns a string in a class. I'm new in Qt and I've written this class which contains one of the member functions with "string" as a return type but when I run a program with this class, I get an error "string does not name a type". why is this?
Re: Can you have a member function returning a string in a class?
A member function can return anything you wish, including a "string", if there is such type or class in the scope of the class.
It does not make any sense to try to guess what an error message means without seeing the code. And it does not make any sense to ask what an error message means without posting some code.
Re: Can you have a member function returning a string in a class?
The error message means that "string", whatever type that is, has not been declared before use. Usually this is a missing #include or scope issue.