C++结构体内含链路(指向结构体本身的指针)如何转换为C#

月光小提琴 2012-11-24 10:02:43
struct Student{
char *name;
int score;
struct Student* next;
};

如何转成C#的代码。
...全文
146 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
月光小提琴 2012-11-25
  • 打赏
  • 举报
回复
嗯,我试一试。多谢。
dataxdata 2012-11-24
  • 打赏
  • 举报
回复
不要用struct,要用class
月光小提琴 2012-11-24
  • 打赏
  • 举报
回复
struct Student { public string name; public int score; private Student next; } 会报错。 在结构布局中导致循环
月光小提琴 2012-11-24
  • 打赏
  • 举报
回复
是结构体转结构体,不是转为类。
dataxdata 2012-11-24
  • 打赏
  • 举报
回复
大概应该是这样吧

class Student {
    public string name;
    public int score;
    private Student next;
}
月光小提琴 2012-11-24
  • 打赏
  • 举报
回复
stu.name: 0019FEE0 stu.score: 0019FEEC stu.next->name: 00506C40 stu.next->score: 00506C4C 这个是测试内存地址的结果。

552

社区成员

发帖
与我相关
我的任务
社区描述
C++ Builder 茶馆
社区管理员
  • 茶馆
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧