Reputation: 13575
When I hover my cursor on a function called in my code in Visual studio 2012, a small box pops up to show its declaration. How let this work for constructors?
Function(1, 2); // Hover on Function
MyClass a(1, 2); // Hover on a or MyClass or use any shortcut key
Upvotes: 3
Views: 1953
Reputation: 244991
The problem is C++'s syntax for constructor calls. It works fine with normal methods because they look like method calls. Constructor calls are all mixed up with the object declaration, and when you hover over them, VS just gives you a tooltip with the object's declaration because it assumes that's what you want.
Hovering over the text gets you the same tooltip as if you had invoked the "Display Quick Info" command (Ctrl+K, Ctrl+I).
But there is also the "Display Parameter Info" command, invoked with Ctrl+Shift+Space, that will display the information you're interested in for constructors.
The trick is that you have to invoke the command with the caret inside of the parentheses. It won't work when the caret is somewhere within the identifier.
Upvotes: 5