This code is for some reason wrong. I've gone over it 20 times and cannot figure it out.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
#include "second.h"
#include <iostream>
#include <string>
#include "main.h"
using namespace std;
second::second() {
second(string z) {//error line
setName(z);
}
void setName(string x){
name = x;
}
string getName(){
return name;
}
};
two::two(){
int b = 45;
cout << b;
}
| |
Build messages:
||=== Build: Debug in Guide (compiler: GNU GCC Compiler) ===|
C:\Users\secret\Desktop\Guide\src\second.cpp||In constructor 'second::second()':|
C:\Users\secret\Desktop\Guide\src\second.cpp|8|error: expected primary-expression before '(' token|
C:\Users\secret\Desktop\Guide\src\second.cpp|8|error: expected primary-expression before 'z'|
C:\Users\secret\Desktop\Guide\src\second.cpp|8|error: expected ';' before '{' token|
C:\Users\secret\Desktop\Guide\src\second.cpp|11|error: a function-definition is not allowed here before '{' token|
C:\Users\secret\Desktop\Guide\src\second.cpp|14|error: a function-definition is not allowed here before '{' token|
||=== Build failed: 5 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|