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

@@ -1,27 +1,28 @@
/**
* @file abstract.cpp
* @brief 抽象类中:在成员函数内可以调用纯虚函数,在构造函数/析构函数内部不能使用纯虚函数
* @brief
* 抽象类中:在成员函数内可以调用纯虚函数,在构造函数/析构函数内部不能使用纯虚函数
* 如果一个类从抽象类派生而来,它必须实现了基类中的所有纯虚函数,才能成为非抽象类
* @author 光城
* @version v1
* @date 2019-07-20
*/
#include<iostream>
#include <iostream>
using namespace std;
class A {
public:
virtual void f() = 0; // 纯虚函数
void g(){ this->f(); }
A(){}
virtual void f() = 0; // 纯虚函数
void g() { this->f(); }
A() {}
};
class B:public A{
class B : public A {
public:
void f(){ cout<<"B:f()"<<endl;}
void f() { cout << "B:f()" << endl; }
};
int main(){
B b;
b.g();
return 0;
int main() {
B b;
b.g();
return 0;
}