Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок+ 1
Is it ok to use const keyword before the void(or any return type) while declaring and defining the constant method of object?
Syntax https://sololearn.com/compiler-playground/cMWOIAqZXQYg/?ref=app
1 ответ
+ 4
Yes but it does make a difference
"myPrint() const" means that the method is const
"const void myPrint()" means that the return type is const. Which is anyways meaningless because its void
So basically the "const void myPrint()" doesnt make the method constant. It makes the return type