support bazel complie this project and format code.

This commit is contained in:
zhangxing
2023-03-30 00:15:11 +08:00
committed by light-city
parent 1f86192576
commit 3c8a3f259b
641 changed files with 10349 additions and 9523 deletions

View File

@@ -2,33 +2,31 @@
* @file pure_virtual.cpp
* @brief 纯虚函数:没有函数体的虚函数
* 抽象类:包含纯虚函数的类
*
*
* @author 光城
* @version v1
* @date 2019-07-20
*/
#include<iostream>
#include <iostream>
using namespace std;
class A
{
class A {
private:
int a;
int a;
public:
virtual void show()=0; // 纯虚函数
virtual void show() = 0; // 纯虚函数
};
int main() {
/*
* 1. 抽象类只能作为基类来派生新类使用
* 2. 抽象类的指针和引用->由抽象类派生出来的类的对象!
*/
A a; // error 抽象类,不能创建对象
int main()
{
/*
* 1. 抽象类只能作为基类来派生新类使用
* 2. 抽象类的指针和引用->由抽象类派生出来的类的对象!
*/
A a; // error 抽象类,不能创建对象
A *a1; // ok 可以定义抽象类的指针
A *a1; // ok 可以定义抽象类的指针
A *a2 = new A(); // error, A是抽象类不能创建对象
A *a2 = new A(); // error, A是抽象类不能创建对象
}