virtual 在类外使用

xuegao007 2009-11-12 08:53:14
#ifndef DBDIMVAR_H
#define DBDIMVAR_H
//
// (C) Copyright 1993-2006 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
//
// DESCRIPTION:
// The api for dimensioning variables shared by
// AcDbDatabase,
// AcDbDimstyleTableRecord, and
// AcDbDimension

// ------------------------- Dimension Style get methods
//
virtual int dimadec () const; // new to R15
virtual bool dimalt () const;
virtual int dimaltd () const;
virtual double dimaltf () const;
...
...
#endif // ifndef DBDIMVAR_H
----------------------------------------------------------------------------
以上代码是在一个.h文件中.文件中的函数全是virtual这样的.没有类的存在.
小弟不明白这个virtual是怎么用的
...全文
100 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
xuegao007 2009-11-12
  • 打赏
  • 举报
回复
正如2,4楼所说的一样.
谢谢大家
nwao7890 2009-11-12
  • 打赏
  • 举报
回复
應該是這個文件會被其它 不同的頭文件包含,跟2樓說的一樣
sj13426074890 2009-11-12
  • 打赏
  • 举报
回复
学习了
xingzhe2001 2009-11-12
  • 打赏
  • 举报
回复
因为这个头文件他会在类里面include,所以就相当于定义到类里面一样。
liuhao159753 2009-11-12
  • 打赏
  • 举报
回复
后面的子类里面按实际情况具体实现它,上面不是纯虚,也可以再当前类里面实现~~

64,636

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

试试用AI创作助手写篇文章吧