- 博客(11)
- 资源 (1)
- 收藏
- 关注
原创 7th_drv.c
7th_drv.c驱动层: static struct timer_list buttons_timer; static struct pin_desc *irq_pd;/* * 确定按键值 */static irqreturn_t buttons_irq(int irq, void *dev_id){/* 10ms后启动定时器 */irq_pd
2015-10-08 13:32:35 387
原创 first_drv/second_drv/third_drv.c/forth_drv.c/fifth_drv.c
(1)first_drv.c(2)second_drv.c //使用查询法 在第二个驱动程序中,使用查询法: 1.内核的 key_vals[i]=gpfdat 进行读值 2.copy_to_user(buf,key_vals,sizeof(key_vals));将key_vals赋给buf(内核层传递数据到用户层) 3.read(fd,key_vals,sizeo
2015-10-08 13:31:42 496
原创 c++学习笔记十七
43、44、虚析构函数#includeclass A{public:A() { cout~A() { cout};class B:public A{public:B() { coutB(int i) { buf=new char[i]; cout~B(){delete buf;cout}private:char *bu
2015-10-08 13:28:22 305
原创 c++学习笔记十六
40、虚函数#includeclass A{public:A() { coutvirtual void f() { cout};class B:public A{public:B() { f(); coutvoid g() { f(); }};class C:public B{public:C() { coutvirtual
2015-10-08 13:26:59 347
原创 c++学习笔记十五
38、静态束定 #includeclass Point{public: Point(double i,double j) { x = i;y = j; }double Area() const { return 0; } private:double x,y;};class Rectangle:public Point{public:Rect
2015-10-08 13:26:04 416
原创 c++学习笔记十四
32、运算符重载为友元函数 #includeclass complex {public:complex(double i=0,double j=0);friend complex operator -(const complex & c1,const complex & c2);friend complex operator +(const complex & c1,
2015-10-08 13:25:14 284
原创 c++学习笔记十三
31、多态性和虚函数 多态性:发出同样的消息被不同类型的对象接受导致完全不同的行为; 多态可分为:静态多态性与动态多态性; 动态多态性必须存在于继承的环境中; 在类中,构造函数可以重载,普通成员函数也可以重载;构造函数重载给初始化带来了多种方式,为用户提供了更大的灵活性。#include#includeclass string{public:st
2015-10-08 13:24:15 325
原创 c++学习笔记十一
27、构造函数#includeclass B{public:B();B(int);~B();void Print() const;private:int b;};B::B(){b = 0;cout}B::B(int i){b = i;cout}B::~B(){cout}void B::Print
2015-10-08 13:22:27 283
原创 c++学习笔记十二
28、多继承 #includeclass B1{public:B1(int i) { b1 = i; coutvoid Print() { coutprivate:int b1;};class B2{public:B2(int i) { b2 = i; coutvoid Print() { coutprivate:int b2;}
2015-10-08 13:20:39 359
原创 c++学习笔记十
26、a.公有类继承 继承方式的作用:控制基类中声明的成员在多大的范围内能被派生类的用户访问。#includeclass Location{public:void InitL(int xx,int yy);void Move(int xOff,int yOff);int GetX() { return X; }int GetY() { return Y
2015-10-08 13:19:51 378
原创 c++学习笔记九
25、堆对象a.在程序中运行过程中根据需要可以随时建立或删除的对象。b.堆对象运算符:new、deletec.new运算符 new创建数组: new []例如: A *ptr;ptr = new A[5]; 1.使用new创建对象数组或一般数组时,不能为该数组指定【初始值】, 其初始值为【缺省值】。 2.使用new[]创建对象数
2015-10-08 13:18:38 528
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人