Question related to function overloading with respect to constant functions

11 views
Skip to first unread message

Aman Tripathi

unread,
Apr 24, 2023, 3:36:31 AM4/24/23
to Discussion forum for Programming in Modern C++
if there are functions with the same name create overloading error then why this program doesn't throw error and runs smoothly even having the same name at line 8 & 9.Screenshot (149).png

soumen paul

unread,
Apr 26, 2023, 2:40:57 AM4/26/23
to Discussion forum for Programming in Modern C++, Aman Tripathi
Because of the constness. One is declared as constant which can only be called using constant object and another function needs to be called using non-const object.
Reply all
Reply to author
Forward
0 new messages