成员函数看不到该类的私有成员

时间:2019-10-27 12:21:21

标签: class visual-c++

成员函数(reverseString())必须旋转字符串,但是当我创建并尝试在成员函数(char *temporary = stringo;)中初始化新指针时,显然它看不到该成员。类(虽然不是全部代码)。

#include"Header.h"
#include<iostream>

using namespace std;

Stringfuncs::Stringfuncs(char *string)
{
this->stringo = string;
}

int Stringfuncs::lengthString()
{
int counter = 0;

for (int i = 0; stringo[i]; i++) { counter++; }

return counter;
}

char Stringfuncs::*reverseString()   //this function doesn't see the member of the class
{
char *temporary = stringo;  //identifier "stringo" isn't defined
}

0 个答案:

没有答案