diff --git a/basic_content/const/class_const/overload_example/main.cpp b/basic_content/const/class_const/overload_example/main.cpp index 6db881a..4ef0868 100644 --- a/basic_content/const/class_const/overload_example/main.cpp +++ b/basic_content/const/class_const/overload_example/main.cpp @@ -2,15 +2,21 @@ #include"apple.cpp" using namespace std; const int Apple::apple_number=10; -Apple::Apple(int i) +#include +#include"apple.cpp" +using namespace std; + +Apple::Apple(int i):apple_number(i) { } -int Apple::add(int num){ - take(num); +int Apple::add(){ + take(1); + return 0; } int Apple::add(int num) const{ take(num); + return num; } void Apple::take(int num) const { @@ -19,14 +25,14 @@ void Apple::take(int num) const int Apple::getCount() const { take(1); -// add(); //error + add(); // error return apple_number; } int main(){ Apple a(2); cout<