/
githubmirror
/
CPlusPlusThings
Обзор
Документация
Войти
/
githubmirror
/
CPlusPlusThings
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
english/basic_content/const/class_const/overload_example/main.cpp
32 строки
498 B
xliu79
english
18 июл 2020, 12:09
18 июл 2020, 12:09
31c5da6
Код
Авторство
О чём код?
#include<iostream> #include"apple.cpp" using namespace std; const int Apple::apple_number=10; Apple::Apple(int i) { } int Apple::add(int num){ take(num); } int Apple::add(int num) const{ take(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(100); return 0; }