Hello, I'm currently working on a quick assignment for school to get used to working with classes and constructors, and I had a few things that I wasn't sure about. First off, there are no underlined errors with this code, however when I compile I get the following error:
unresolved external symbol "public_thiscall dog::dog(void)" (??0dog@@QAE@XZ) referenced in function_main
So I assume that the problem is it doesn't like that I called the void dog::dog (which I don't even think exists?)
I've tried poking around for the error, but the error seems to be very broad and case-specific. I did at one point have a void dog::dog, so maybe that has something to do with it.
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 30 31 32 33 34 35
|
#include<iostream>
#include<conio.h>
#include<string>
using namespace std;
class dog
{
private:
char dogName[10];
char dogSays[10];
public:
dog();
void dogz();
void speak(char name[], char says[]);
};
void dog::dogz()
{
char name[10];
char says[10];
dogName[10] = name[10];
dogSays[10] = says[10];
strcpy(name, dogName);
strcpy(says, dogSays);
}
void dog::speak(char name[], char says[])
{
cout <<"The dogs name is "<<name<<" and he says "<<says<<endl;
}
void main()
{
dog stuff;
stuff.speak("Rover", "Woof");
getch();
}
|
Second, the bolded void dog::dogz() part seems weird to me. I don't even know if any of that is doing anything, or if its necessary, but it's in my notes to use it, and making all those arrays and chars and what not was the only way I could figure out how to make the code work (no underlines, that is)
If anyone could maybe point me in the right direction, that'd be great. Thanks in advance!