关于下面程序说法正确的是(    ...
发布于 2022-03-03 14:11:25
关于下面程序说法正确的是( )
class Item
{
private:
char *desc
int storage
public:
Item()
{
desc = new char[51]
}
void setInfo(char *dsrc, int num)
{
strcpy(desc,dsrc)
storage = num
}
}
int main()
{
Item stock
stock.setInfo("pen",20)
return 0
}
class Item
{
private:
char *desc
int storage
public:
Item()
{
desc = new char[51]
}
void setInfo(char *dsrc, int num)
{
strcpy(desc,dsrc)
storage = num
}
}
int main()
{
Item stock
stock.setInfo("pen",20)
return 0
}
登录后免费查看答案
关注者
0
被浏览
70