码迷,mamicode.com
首页 > 其他好文 > 详细

similarity and difference between "struct" and "class"

时间:2017-04-23 17:58:42      阅读:97      评论:0      收藏:0      [点我收藏+]

标签:public   sim   tween   and   person   efi   can   efault   int   

similarity:

1. struct is class, can declare, define field funcion

 struct Person {
    int age;
    int height;
    void SetAge(int age);
    int GetAge();
};

class Person {
    int age;
    int height;
    void SetAge(int age);
    int GetAge();
};

difference:

1. class default field is private, struct default field is public

similarity and difference between "struct" and "class"

标签:public   sim   tween   and   person   efi   can   efault   int   

原文地址:http://www.cnblogs.com/roadmap99/p/6752988.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!