📄 c51b.cpp
字号:
// c51b.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream.h>
class Base
{
public:
virtual void Fn( int x )
{
cout << "In Base class, int x = " << x << endl;
}
};
class SubClass : public Base
{
public:
virtual void Fn( float x )
{
cout << "In Subclass, float x = " << x << endl;
}
};
void Test( Base& b )
{
int i = 1;
b.Fn( i );
float f = 2.0;
b.Fn( f );
}
int main(int argc, char* argv[])
{
Base bc;
SubClass sc;
cout << "Calling Test(bc)\n";
Test( bc );
cout << "Calling Test(sc)\n";
Test( sc );
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -