Class Compile Error

I need to write several functions in a class and so far my current function seems to be going OK, but the compiler is having an issue with the class itself.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
class UserInputHandler() {
  char GetSingleCharacter() {
    std::string str;
    const std::char letter;
    int i;
    i = (int)str.length();
    const std::char invalid_char_input_("Failure: Too many characters.");
    const std::char char_not_allowed_("Failure: Invalid character.");
    std::getline(std::cin, str);
    if (std::string::npos == str.find_first_not_of("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")) {
      if (i > 1) {
        std::cout << invalid_char_input_;
        letter = invalid_char_input_;
      } else {
        std::cout << str;
        letter = str;
      }
    } else {
      std::cout << char_not_allowed_;
      letter = char_not_allowed_;
    }
    return letter;
  }
}

int main() {
  UserInputHandler();
  return 0;
}


This is the code and this is what the compiler is giving me

1
2
3
4
5
6
7
$ make
/usr/bin/g++ -Wall -Wextra -g assignment_2.cpp  -o assignment_2
assignment_2.cpp:18:24: error: expected unqualified-id before ‘)’ token
 class UserInputHandler() {
                        ^
makefile:10: recipe for target 'assignment_2' failed
make: *** [assignment_2] Error 1


I have no idea what this means though.
Which line is line 18?
The first line is 18 in my word file.
Review the syntax for defining a class. Parenthesis are not involved.
Topic archived. No new replies allowed.