double*f(int x,int y) double c,q,*p; c=sqrt(x*x+y*y); q=atan(y/x); p=new double(sizeof(double)*2); *p=C时 p++; *p=q时 p-氵 return p; } double*fl(int x,int y,double*m) double c,q,*p; c=sqrt(x*x+y*y)方 p=new double(sizeof(double)); q=atan(y/x); *p=C; *m=q; return p; 2017年4月26日12时 H0座务 第8章类和对象 11 BACK NEXT
HOME• double* f(int x,int y){ double c,q,*p; c=sqrt(x*x+y*y); q=atan(y/x); p=new double(sizeof(double)*2); *p=c; p++; *p=q; p--; return p; }double*f1(int x,int y,double*m){ double c,q,*p; c=sqrt(x*x+y*y); p=new double(sizeof(double)); q=atan(y/x); *p=c; *m=q; return p; } 2017年4月26日12时 12分 第8章 类和对象 11
第8章类和对象 8.1面向对象程序设计方法概述 8.2类的声明和对象的定义 8.3类的成员函数 8.4对象成员的引用 8.5类的封装性和信息隐蔽 8.6类和对象的简单应用举例 2017年4月26日12时 第8章类和对象 13 BACK NEXT
HOME2017年4月26日12时 12分 第8章 类和对象 13 8.1 面向对象程序设计方法概述 8.2 类的声明和对象的定义 8.3 类的成员函数 8.4 对象成员的引用 8.5 类的封装性和信息隐蔽 8.6 类和对象的简单应用举例
Review:Structured programming Emphases: How to separate the data from the function Form: Main module several sub-module (mainO+sub- functions。 Characteristic: -Break up the task into several modules. .Defects: Low efficiency, reuse rate of the program is low. 2017年4月26日12时 H0$分 第8章类和对象 BACK NEXT
HOME2017年4月26日12时 12分 第8章 类和对象 14 • Emphases: – How to separate the data from the function • Form: – Main module + several sub-module (main()+ subfunctions)。 • Characteristic: – Break up the task into several modules。 • Defects: – Low efficiency,reuse rate of the program is low
OOP,object oriented programming Purpose: Realize the industrialization of software design Viewpoint: -The nature is composed of entities (objects) ·Programmer method: Use the viewpoint of object-oriented to describe and handle the actual problems Request: -Highly-generalization classification and abstract. 2017年4月26日12时 第8章类和对象 BACK NEXT
HOME2017年4月26日12时 12分 第8章 类和对象 15 • Purpose: – Realize the industrialization of software design • Viewpoint: – The nature is composed of entities (objects) • Programmer method: – Use the viewpoint of object-oriented to describe and handle the actual problems • Request: – Highly-generalization、classification and abstract
8.1 object oriented programming,OOP 面向过程的程序设计对于大规模开发程序,显 得力不从心。 面向对象程序设计(object oriented programming,OOP)的思路: 委托式指挥 搬运工 2017年4月26日12时 第8章类和对象 16 BACK NEXT
HOME2017年4月26日12时 12分 第8章 类和对象 16 面向过程的程序设计对于大规模开发程序,显 得力不从心。 面向对象程序设计(object oriented programming, OOP)的思路: 委托式指挥 搬运工