mirror of
https://github.com/Light-City/CPlusPlusThings.git
synced 2026-02-03 10:33:25 +08:00
support bazel complie this project and format code.
This commit is contained in:
@@ -1,38 +1,12 @@
|
||||
#include<iostream>
|
||||
#include"apple.cpp"
|
||||
using namespace std;
|
||||
const int Apple::apple_number=10;
|
||||
#include<iostream>
|
||||
#include"apple.cpp"
|
||||
#include "apple.h"
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
Apple::Apple(int i):apple_number(i)
|
||||
{
|
||||
|
||||
}
|
||||
int Apple::add(){
|
||||
take(1);
|
||||
return 0;
|
||||
}
|
||||
int Apple::add(int num) const{
|
||||
take(num);
|
||||
return num;
|
||||
}
|
||||
void Apple::take(int num) const
|
||||
{
|
||||
cout<<"take func "<<num<<endl;
|
||||
}
|
||||
int Apple::getCount() const
|
||||
{
|
||||
take(1);
|
||||
add(); // error
|
||||
return apple_number;
|
||||
}
|
||||
int main(){
|
||||
Apple a(2);
|
||||
cout<<a.getCount()<<endl;
|
||||
a.add(10);
|
||||
// const Apple b(3);
|
||||
// b.add(); // error
|
||||
return 0;
|
||||
int main() {
|
||||
Apple a(2);
|
||||
cout << a.getCount() << endl;
|
||||
a.add(10);
|
||||
// const Apple b(3);
|
||||
// b.add(); // error
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user