首页 | 本学科首页   官方微博 | 高级检索  
相似文献
 共查询到19条相似文献,搜索用时 187 毫秒
1.
本文讲述了在Visual C++6.0环境下,类的定义的三种方法,并且讲述了在类的外部实现类的成员函数时要注意的问题:包括派生类的构造函数中的初始化表,带缺省参数的成员函数、虚拟成员函数等。  相似文献   

2.
C++对象的持久化中的问题和解决方案   总被引:1,自引:0,他引:1       下载免费PDF全文
陶伟  麦中凡 《软件学报》1996,7(2):73-82
多媒体智能数据库系统MIDS(multimediaintelligentdatabasesystem)是一个对象数据库管理系统.它的数据库编程语言是P++,P++个语言是一种基于C++的语言.作者在P++的实现过程中遇到了以下问题:首先,C++的指针有二义性,它无法在语义上区分成员指针和引用指针,以及易失性指针和持久性指针,从而给事务管理中的对象加锁及其它方面带来问题.其次,具有虚拟函数或虚拟基类的对象中含有指向内存中的指针,而这些指针不是由程序员定义的.如果C+个对象被持久化,这些指针在不同的程序调用中有可能无效.最后,如果作者用文件系统调用来存储对象,那么必须要设计复杂的Cache系统和做大量对象的格式转化工作,这需要大量的空间和时间,所以他们采用了另外的一种方法──基于虚拟内存空间映射的存储方案.  相似文献   

3.
《计算机教育》2008,(13):53-55
本文以C为元语言,C++为对象语言,以C++类串中的构造函数、析构函数、赋值函数和成员转换函数等概念为例,用C程序描述它们的产生过程,进而用C程序描述C++程序。  相似文献   

4.
C~(++)中的操作符重载(续一)OperatoroverloadinginC~(++)JOOP¥//(上接94年第4期)现在我们有一个说明复数的类,我们可以说明一个复数类型的对象,并且通过调用成员函数执行对象的操作,认识到无论何时,成员函数被引用都是...  相似文献   

5.
构造函数是C++类体系中的重要组成部分,构造函数主要用来在创建对象时初始化。构造函数有默认构造函数、拷贝构造函数,并且还可用来完成对象的转型与赋值的单参数构造函数。结合学习和编程经验,对各类构造函数的作用以及初学者常常疑惑的构造函数的调用问题进行探究。  相似文献   

6.
首先介绍了类的构造函数特征和分类,举例说明了组合类对象和派生类对象构造函数的构造方法及调用次序;其次研究了使用缺省拷贝构造函数时,如果类中包含new运算符而导致指针挂起的原因,并给出了解决方法;最后介绍了转换构造函数的功能及使用转换构造函数进行类型转换的步骤。  相似文献   

7.
陈凤祥  李汪根 《微机发展》2010,(2):79-82,86
数组是应用程序中经常要用到的一种数据结构。为解决C++定义后的数组不能改变其大小的情况,根据软件重用的思想,给出了用函数模板、动态数组类和数组类模板生成C++动态数组的方法,并对这些方法在代码重用方面进行了比较。文中主要给出了动态生成二维数组的函数模板、动态数组类和数组类模板的定义,以及部分成员函数和运算符重载函数的实现代码或算法。以动态生成二维整型数组,进行矩阵的加法运算为例,给出了使用方法。应用文中所给的方法,能满足应用程序中动态定义一维和二维数组的需要。  相似文献   

8.
栈作为一种后进先出结构,在程序设计中广泛使用。类模板是C++所提供的一种占有重要地位的特殊机制,能根据不同参数建立不同类型对象的类。通过类模板建立通用栈类,栈中便可以存放任意类型的数据,提高编程效率,增强软件通用性和灵活性。简要介绍了栈的概念和C++的模板类的定义和使用,并利用模板类实现了通用的栈结构,还给出了在Visual C++环境使用的实例。  相似文献   

9.
汇编语言是面向计算机硬件的符号化的机器语言,通过学习汇编语言可以加深对计算机内部原理以及高级编程语言的理解。借助汇编语言低级化的特点,通过一个简单的C++小程序和其对应的反汇编代码,从汇编语言的角度详细地分析和展示C++中类和对象各成员在内存中的分布特点,从而帮助读者从本质上理解类、对象、成员变量和成员函数之间的各种关系。  相似文献   

10.
A 拷贝构造函数与拷贝赋值操作是类中两个非常重要的特殊成员函数,这里分析了两者的使用规划、调用时机和区别,着重讨论了浅拷贝与深拷贝的问题.  相似文献   

11.
本文讲述了在VisualC 6.0环境下,在含有虚拟基类、非虚拟基类及成员对象的多重继承的情况下,C 中派生类的构造函数的执行顺序  相似文献   

12.
Summary Affix grammars are an extension of context-free grammars which retain most of their advantages and eliminate most of their limitations with respect to the definition of programming languages and the specification of their translators. The extension allows definition of context-sensitive syntax features, and also allows semantics to be linked to syntax. In this paper, the parsing problem for affix grammars is explored and shown to be closely related to the parsing problem for context-free grammars. This enables a standard context-free parser constructor to be generalised to a constructor for affix grammars, essentially by addition of a preprocessor. The resulting constructors are compared with previously implemented or proposed constructors.  相似文献   

13.
In this paper, we present a Newton-type method for a class of mathematical programs with complementarity constraints. Under the MPEC-LICQ, we use the definition of B-stationary point to construct a constrained equations model, and apply the Newton method to solve the problem. At the end of this paper, numerical results are reported to show our method's validity.  相似文献   

14.
随着各种新的网络业务不断出现,网络处理器得到了日益广泛的应用。文章采用基于SystemC的系统设计方法,构建一个用于网络处理器体系结构建模的平台。这个平台由一个可扩展的异构资源库和一个体系结构构造器组成。设计者只需提交配置信息表,体系结构构造器就能自动生成模型实例,得到的模型可以方便地进行细化和性能评价。这种方法能够便捷地完成各种网络处理器的体系结构建模,便于网络处理器的优化设计。  相似文献   

15.
单伟  党齐民 《计算机工程》2005,31(19):93-95
通过使用一种基于谓词逻辑的形式化框架来匹配对象模型到关系模型以构建持久对象层。文中涉及了类图的形式化定义、类图的操作规则和两种模型之间的转换规则。  相似文献   

16.
In recent years, there have been various problems in medical treatments, of which human error by the surgeon in an operation is one of the most serious. In order to minimize human error in an operation, we need a medical training system by which inexperienced surgeons can try operating again and again to improve their skill. In this research, we construct a system of modeling a virtual dense elastic object, and deforming that object using a haptic device called PHANToM. In the system which we construct, we use two PCs to distribute the process of calculation, and SCRAMNet+ is used to connect each PC. PHANToM is used to operate on the object and to express the force which is generated from the deformation of the object. We represent the dense object by using voxels and tetrahedrons, and the elastic object by using a spring-mass model. A virtual dense elastic object is obtained by computed tomography (CT) or magnetic resonance imaging (MRI) to express the patient’s organs.  相似文献   

17.
In this paper, we describe a new method for the estimation of the fractal dimension of a geometrical object using fuzzy logic techniques. The fractal dimension is a mathematical concept, which measures the geometrical complexity of an object. The algorithms for estimating the fractal dimension calculate a numerical value using as data a time series for the specific problem. This numerical (crisp) value gives an idea of the complexity of the geometrical object (or time series). However, there is an underlying uncertainty in the estimation of the fractal dimension because we use only a sample of points of the object, and also because the numerical algorithms for the fractal dimension are not completely accurate. For this reason, we have proposed a new definition of the fractal dimension that incorporates the concept of a fuzzy set. This new definition can be considered a weaker definition (but more realistic) of the fractal dimension, and we have named this the "fuzzy fractal dimension." We can apply this new definition of the fractal dimension in conjunction with soft computing techniques for the problem of time series prediction. We have developed hybrid intelligent systems combining neural networks, fuzzy logic, and the fractal dimension, for the problem of time series prediction, and we have achieved very good results.  相似文献   

18.
本文讲述了在VisualC 6.0环境下,类的定义的三种方法,并且讲述了在类的外部实现类的成员函数时要注意的问题:包括派生类的构造函数中的初始化表,带缺省参数的成员函数、虚拟成员函数等。  相似文献   

19.
设为首页 | 免责声明 | 关于勤云 | 加入收藏

Copyright©北京勤云科技发展有限公司  京ICP备09084417号