Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite+ 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 Réponse
+ 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