Keine Instanz von überladene Funktion entspricht argument-Liste.

Arbeite ich an einem Projekt für die Klasse, aber erhalte die Fehlermeldung: keine Instanz von überladene Funktion entspricht argument-Liste. Es ist die Referenzierung von meiner String-Klassen. Was ich versuche zu tun ist, erstellen Sie eine Kopie, Concat-Funktion und Count-Funktionen mit mit der string-Klasse. Jegliche Hilfe würde sehr geschätzt werden.

#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <string>

using namespace std;

class String
{
private:
char str[100]; 
char cpy[100];
public:

static const char NULLCHAR = '\0';

String()
{
    str[0] = NULLCHAR;
    cpy[0] = NULLCHAR;
}

String(char* orig, char* cpy)
{
    Copy(orig, cpy);
}

void Display()
{
    cout << str << endl;
}

void Copy(char* orig, char* dest)
{

    while (*orig != '\0') {
        *dest++ = *orig++;
    }
    *dest = '\0';



}

void Copy(String& orig, String& dest) 
{
    Copy(orig.str, dest.cpy);
}

void Concat(char* orig, char* cpy)
{
    while (*orig)
        orig++;

    while (*cpy)
    {
        *orig = *cpy;
        cpy++;
        orig++;
    }
    *orig = '\0';

}

void Concat(String& orig, String& cpy)
{
    Concat(orig.str, cpy.cpy);
}

int Length(char* orig)
{
    int c = 0;
    while (*orig != '\0')
    {
        c++;
        *orig++;
    }
    printf("Length of string is=%d\n", c);
    return(c);

}
};

int main()
{
String s;

s.Copy("Hello");
s.Display();
s.Concat(" there");
s.Display();

String s1 = "Howdy";
String s2 = " there";
String s3;
String s4("This String built by constructor");
s3.Copy(s1);
s3.Display();
s3.Concat(s2);
s3.Display();
s4.Display();


system("pause");
return 0;
}
  • Die Anzahl der argument nicht mit zu Copy und Concat.
InformationsquelleAutor K455306 | 2016-04-22
Schreibe einen Kommentar