C++ 静态联编
2023-09-14 09:07:07 时间
? 联编是指一个计算机程序自身彼此关联的
过程
? 静态联编:编联工作出现在编译连接阶
段,这种联编又称为早期联编,因为联编
过程是在程序开始之前完成的
? 动态联编:编译程序在编译阶段并不能确
切知道将要调用的函数,只有在程序运行
时才能确定将要调用的函数,这要求联编
工作要在程序运行时进行,这种在程序运
行时进行联编工作称为动态联编
#include <iostream>
using std::cin;
using std::cout;
using std::endl;
class Point{
private:
double x, y;
public:
Point(double i, double j){
x = i;
y = j;
}
double Area() const{
return 0.0;
}
};
class Rectangle:public Point{
private:
double w, h;
public:
Rectangle(double i,double j,double k,double l);
double Area() const{
return w * h;
}
};
Rectangle::Rectangle(double i,double j,double k,double l):Point(i, j){
w = k;
h = l;
}
void fun(Point &s){
cout<<s.Area()<<endl;
}
int main(){
Rectangle rec(3.0,5.2,15.0,25.0);
fun(rec);
return 0;
}
相关文章
- c++全局变量与静态变量「建议收藏」
- C++类中静态变量和静态方法使用介绍
- 将JS嵌入C++ ————Spidermonkey引擎的使用「建议收藏」
- C++stl库_c++库
- C++ 中用于动态内存的 的 new 和 delete 运算符
- C++字符串加密_c++字符串连接函数
- c++的链表-链表入门(C++)
- C/C++ 读取文件16进制格式
- 【C++修炼之路】26.C++11(语法糖)
- c++基础篇之C++ 模板
- C++静态成员变量和静态成员函数详解
- C++ multiset,STL multiset详解
- 深入理解C++的动态绑定与静态绑定的应用详解
- 深入探讨C++父类子类中虚函数的应用
- C++类的静态成员深入解析
- C++类的静态成员初始化详细讲解
- VC++中HTControl控件类之CHTRichEdit富文本编辑控件实例