0 / 0 / 0
Регистрация: 25.01.2013
Сообщений: 5
|
||||||
1 | ||||||
function overloading31.08.2013, 17:27. Показов 1435. Ответов 7
Метки нет (Все метки)
День добрый.
Что такое function overloading я понимаю, но вот не очень въезжаю, что требуется от меня в задании (учусь в универе прикладных наук по спец. IT) Вот задание: Write functions initialize_xy, that initializes two double variables that are passed as parameters. If we call the function in the form initialize_xy(&x, &y, 1.0, 2.0) it gives x a value 1.0 and y a value 2.0. If, on the other hand, we call function in the form initialize_xy(&x, &y) both variables get a value 0.0. You need to use function overloading to achieve this. Write a short main function to test these functions (it only calls these two functions and displays the values of double variables after each call). Remark. It is required that call in the test main function is exactly as given initialize_xy(&x, &y, 1.0, 2.0). Если следовать заданию, то получается вот что -
0
|
31.08.2013, 17:27 | |
Ответы с готовыми решениями:
7
Overloading [] operators С концами запутался с operator overloading C:\Dev-Cpp\lib\vector.h `ostream' is neither function nor member function; cannot be declared friend Многофайловая программа, ошибка: unresolved external symbol 'symbol' referenced in function 'function' |
0 / 0 / 0
Регистрация: 25.01.2013
Сообщений: 5
|
|
31.08.2013, 17:45 [ТС] | 4 |
Теперь показывает всё время 0. Значения не меняются.
Как сделать это - If we call the function in the form initialize_xy(&x, &y, 1.0, 2.0) it gives x a value 1.0 and y a value 2.0.
0
|
0 / 0 / 0
Регистрация: 25.01.2013
Сообщений: 5
|
||||||
31.08.2013, 17:48 [ТС] | 6 | |||||
0
|
0 / 0 / 0
Регистрация: 25.01.2013
Сообщений: 5
|
|
31.08.2013, 17:50 [ТС] | 8 |
А я то думал, что не так задание понял. Спасибо. Просто думал, что при передачи адреса, можно сразу же и поменять значение.
Точно. Вывод в main
0
|
31.08.2013, 17:50 | |
31.08.2013, 17:50 | |
Помогаю со студенческими работами здесь
8
Почему возникает ошибка "function returning function is not allowed" If a function throws an exception that is not listed in the function exception-specification list Class member function to std::function Overloading+Overriding Искать еще темы с ответами Или воспользуйтесь поиском по форуму: |