c++ Class Header - "error: expected unqualified-id before ')' token" -


I should look a bit simpler, but in such a short time I have to do so that I have to do more work. Anyway, here's the place where I'm getting the error.

  #include & lt; Iostream & gt; # Include & lt; Algorithm & gt; #ifndef number # defined number class number {public: number () {efficiency = 5; Used = 0; Data = New unsigned long [capability];}  

This is simply a creator for class numbers as follows: The private sector of the class is as follows.

Private: unsigned long * data; Used Std :: size_t; Std :: size_t Capacity; };

Again, maybe it's something that I can not see right now and I'm sure others have to run into problems too.

Edit: The error is as follows

  numbers.h: 9: 11: error: before expected inefficient id) 'token number () {capability = 5; Used = 0; Data = New unsigned long [capability];} ^  

Run through a preprocessor, It:

  #ifndef number # defined number class number {public: number () {capability = 5; Used = 0; Data = new unsigned long [capability];}  

becomes it :

  class {public: () { Capacity = 5; Used = 0; Data = New unsigned long [capability];}  

Your class name is similar to your included-guard fence post macro, as it will be replaced by number . < Em> anything .. you will not get a class name, nor the constructor's name. Do not do it

Try:

  #ifndef MYAPP_NUMBERS_H #define MYAPP_NUMBERS_H #include & lt; Iostream & gt; # Include & lt; Algorithm & gt; Class number {public: number () {efficiency = 5; Used = 0; Data = new unsigned long [capacity]; } ... etc ...  

Comments

Popular posts from this blog

Member with no value in F# -

java - Joda Time Interval Not returning what I expect -

c# - Showing a SelectedItem's Property -