我想成为会员功能" getList"打印名单。
但是,我没有任何线索可以使用指针的指针。
任何评论对我都有帮助。
class Happy
{
private:
MyString name;
int money;
char* list[100]; // I'd like to save a shopping list here.
int index;
public:
Happy(char* np=NULL, int money=10000);
Happy(Happy &r);
~Happy();
Happy &operator=(Happy &r);
void use(char* ip, int n);
Happy &winner(Happy &r);
void setName(MyString &name);
MyString &getName();
void setMoney(int money);
int getMoney();
char** getList(); // I'd like to print the shopping list with a pointer's pointer.
int getIndex();
};
//----------------------------------------
char** Happy::getList()
{
// How should I fill this block so that I could print lists?
}
答案 0 :(得分:0)
你可以简单地return list;
。