#include <stdio.h> struct student { int a; int b; int add(){ //在结构体内封装了函数 return a+b; } }; int main(){ struct student s={10,20}; int x=s.add(); printf("%d\n",x); }
C++ 封装
猜你喜欢
转载自www.cnblogs.com/liming19680104/p/13399660.html
今日推荐
周排行