当前位置: 首页 > news >正文

呼和浩特公司做网站亚马逊跨境电商能赚钱吗

呼和浩特公司做网站,亚马逊跨境电商能赚钱吗,网络营销就是网上营销,爱站网关键词挖掘查询工具本文参考#xff1a; c语言面向对象之封装c面向对象之继承Linux源码分析之多态 一、封装 封装的本质就是将数据和方法集中到一个对象中#xff0c;c或者java使用的是class来实现。c语言中可以使用struct来实现同样的功能。比如下面的程序#xff1a; struct student {int…本文参考 c语言面向对象之封装c面向对象之继承Linux源码分析之多态 一、封装 封装的本质就是将数据和方法集中到一个对象中c或者java使用的是class来实现。c语言中可以使用struct来实现同样的功能。比如下面的程序 struct student {int age;char *name;void (*read)(char *); };void read_book(char *book) {printf(book is :%s, book); }int main(void) {struct student s1;s1.age 10;s1.name strdup(xiaoming);s1.read read_book;printf(name: %s age: %d\n, s1.name, s1.age);s1.read(math);free(s1.name)return 0; }二、继承 继承可以让子类使用父类的资源减少重复。父类可以是将子类的共同点抽象出来提升代码层次。 如何使用c来实现同样的效果首先肯定还是需要struct来构建父类和子类同时如果要达到is a的效果从内存空间来看也就意味着父类占据了子类内存地址的最开始位置。所以我们可以按照下面的方式来构造继承。 struct parent {void (*func1)(void); };struct child {struct parent pt;void (*func2)(void); };void test(struct parent *p) {p-func1(); }int main() {struct child cd;test((struct parent *)cd); }三、多态 多态就是在程序运行时父类指针可以根据具体的子类对象来执行不同的函数行为。c中一般通过虚函数来实现。c实现多态主要是通过结构体和函数指针。 #include stdio.h // 定义基类 struct Shape { void (*draw)(struct Shape*); };// 定义派生类 struct Circle { struct Shape shape; int radius; };struct Rectangle { struct Shape shape; int width; int height; };void drawCircle(struct Shape *shape) { printf(Drawing a circle...\n);struct Circle *circle (struct Circle *)shape;printf(Circle radius is %d\n, circle-radius); }void drawRectangle(struct Shape *shape) { printf(Drawing a rectangle...\n);struct Rectangle *rectangle (struct Rectangle *)shape;printf(Rectangle width is %d\n, rectangle-width);printf(Rectangle height is %d\n, rectangle-height); }int main() { struct Circle circle;circle.shape.draw drawCircle;circle.radius 10;struct Rectangle rectangle; rectangle.shape.draw drawRectangle;rectangle.width 10;rectangle.height 20;struct Shape *shape;shape (struct Shape *)circle;shape-draw(shape);shape (struct Shape *)rectangle;shape-draw(shape);return 0; }在Linux内核中数量最多的就是驱动程序代码因为硬件设备是多种多样的每种设备都会有对应的驱动程序。Linux对上层的接口都是统一和抽象的要保证相同的接口最终能够对应到特定的硬件设备这就需要使用多态的技巧。 include/linux/i2c.h 这个结构体定义了不少函数指针就是实现多态的关键struct i2c_driver {unsigned int class;/* Standard driver model interfaces */int (*probe)(struct i2c_client *, const struct i2c_device_id *);int (*remove)(struct i2c_client *);/* New driver model interface to aid the seamless removal of the* current probe()s, more commonly unused than used second parameter.*/int (*probe_new)(struct i2c_client *);/* driver model interfaces that dont relate to enumeration */void (*shutdown)(struct i2c_client *);/* Alert callback, for example for the SMBus alert protocol.* The format and meaning of the data value depends on the protocol.* For the SMBus alert protocol, there is a single bit of data passed* as the alert responses low bit (event flag).* For the SMBus Host Notify protocol, the data corresponds to the* 16-bit payload data reported by the slave device acting as master.*/void (*alert)(struct i2c_client *, enum i2c_alert_protocol protocol,unsigned int data);/* a ioctl like command that can be used to perform specific functions* with the device.*/int (*command)(struct i2c_client *client, unsigned int cmd, void *arg);struct device_driver driver;const struct i2c_device_id *id_table;/* Device detection callback for automatic device creation */int (*detect)(struct i2c_client *, struct i2c_board_info *);const unsigned short *address_list;struct list_head clients;bool disable_i2c_core_irq_mapping; }; drivers/i2c/i2c-slave-eeprom.c
http://www.hkea.cn/news/14567842/

相关文章:

  • 网站建设入门 下载哪个网站做外贸的多
  • 亚马逊的网站建设企业网站建设视频
  • 毕设什么类型网站容易做湖南网站开发 岚鸿
  • asp.net 网站 方案东莞市凤岗建设局网站
  • 诚信网站体系建设工作在国外做外国的网站合法吗
  • 做100个网站只做女性的网站
  • 长沙网站制作收费明细表邯郸网站设计招聘网
  • 驾校一点通网站怎么做购物链接
  • 网站 前端北京it公司排名
  • 网站毕业设计模板linode 安装wordpress
  • 数码产品网站建设计划书企业培训机构有哪些
  • 成都农业网站建设建筑工程公司有哪些岗位
  • 网站服务器分流怎么做怎样做当地网站推广
  • 建设银行网站钓鱼网站不要了该如何处理
  • 节能网站源码如何架设内部网站
  • 深圳响应式网站制作小程序直播开发教程
  • 网站建立需要多久亚马逊雨林电影
  • 剑阁住房和城乡建设厅网站织梦cms做网站
  • 乌市高新区建设局网站网页制作用哪个软件
  • 有哪些网站可以卖自己做的图片企业宣传片制作哪家好
  • 泰国如何做网站推广西安知名网站推广
  • 合肥网站建设信息WordPress adsen
  • 建视频网站无锡网站制作哪家好
  • 先做网站还是先注册公司中国都有哪些网站
  • 户外旅游网站排名网站备案 子域名
  • 手机移动端网站sem推广培训
  • 网站可以在外地备案吗重庆网站建设 渝
  • 搞笑网站全站源码学python能干嘛
  • 做网站怎么连数据库龙岗在线网站制作
  • 建设部网站刘赵云惠州网站seo