{"id":685,"date":"2014-05-30T18:23:23","date_gmt":"2014-05-30T18:23:23","guid":{"rendered":"http:\/\/blog.wholetomato.com\/?p=685"},"modified":"2022-06-22T19:03:26","modified_gmt":"2022-06-22T23:03:26","slug":"automatically-add-c11-override","status":"publish","type":"post","link":"https:\/\/stage.wholetomato.com\/blog\/automatically-add-c11-override\/","title":{"rendered":"Automatically add C++11 override to virtual methods"},"content":{"rendered":"<p>The C++11 standard has been approved and C++14 is around the corner. These\u00c2\u00a0new standards define a lot of interesting language features, one of them being support for the\u00c2\u00a0override identifier. You can append &#8220;override&#8221; to a virtual function declaration and tell the compiler that you want to override a virtual method inherited from a base class. If the virtual method does not exist in the base class, or has a different signature, the compiler raises an error and the compilation fails.<\/p>\n<p><a href=\"https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2014\/05\/blogoverrideexample.png?ssl=1\"><img decoding=\"async\" data-attachment-id=\"662\" data-permalink=\"https:\/\/stage.wholetomato.com\/blog\/blogoverrideexample\/\" data-orig-file=\"https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2014\/05\/blogoverrideexample.png?fit=487%2C100&amp;ssl=1\" data-orig-size=\"487,100\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"blogOverrideExample\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2014\/05\/blogoverrideexample.png?fit=300%2C62&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2014\/05\/blogoverrideexample.png?fit=487%2C100&amp;ssl=1\" class=\"alignnone size-full wp-image-662\" src=\"https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2014\/05\/blogoverrideexample.png?resize=487%2C100&#038;ssl=1\" alt=\"blogOverrideExample\" width=\"487\" height=\"100\" srcset=\"https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2014\/05\/blogoverrideexample.png?w=487&amp;ssl=1 487w, https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2014\/05\/blogoverrideexample.png?resize=300%2C62&amp;ssl=1 300w, https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2014\/05\/blogoverrideexample.png?resize=360%2C74&amp;ssl=1 360w\" sizes=\"(max-width: 487px) 100vw, 487px\" data-recalc-dims=\"1\" \/><\/a><\/p>\n<p>Use of override\u00c2\u00a0is very useful for detecting errors, at compile time, caused by typos and bad\u00c2\u00a0copy-pastes.<\/p>\n<p>Visual Studio has supported override since Visual Studio 2010, and so has Visual Assist. But if you want Visual Assist to insert &#8220;override&#8221; automatically\u00e2\u20ac\u201dwhen using the code generation feature <a href=\"http:\/\/docs.wholetomato.com\/default.asp?W165\">Implement Virtual Methods<\/a>\u00e2\u20ac\u201dyou need to tell it via the Windows Registry.<\/p>\n<p><em>Note: Beginning with Visual Assist build 2042, you can insert &#8220;override&#8221; automatically via the options dialog of\u00c2\u00a0Visual Assist. The following instructions apply to build 2036 and older.<\/em><\/p>\n<p>Exit your IDE(s) so Visual Assist does not overwrite your changes, then using the registry editor, navigate to this key:<\/p>\n<p>HKEY_CURRENT_USER\\Software\\Whole Tomato\\Visual Assist X\\<a href=\"http:\/\/docs.wholetomato.com\/default.asp?W407\">&lt;IDE_SPEC&gt;<\/a><\/p>\n<p>Change the value of\u00c2\u00a0UseOverrideKeywordInImplementInterface from 00 to 01.<\/p>\n<p><a href=\"https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2014\/05\/blogoverrideregistry.png?ssl=1\"><img decoding=\"async\" data-attachment-id=\"663\" data-permalink=\"https:\/\/stage.wholetomato.com\/blog\/blogoverrideregistry\/\" data-orig-file=\"https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2014\/05\/blogoverrideregistry.png?fit=750%2C300&amp;ssl=1\" data-orig-size=\"750,300\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"blogOverrideRegistry\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2014\/05\/blogoverrideregistry.png?fit=300%2C120&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2014\/05\/blogoverrideregistry.png?fit=750%2C300&amp;ssl=1\" class=\"alignnone size-full wp-image-663\" src=\"https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2014\/05\/blogoverrideregistry.png?resize=660%2C264&#038;ssl=1\" alt=\"blogOverrideRegistry\" width=\"660\" height=\"264\" srcset=\"https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2014\/05\/blogoverrideregistry.png?w=750&amp;ssl=1 750w, https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2014\/05\/blogoverrideregistry.png?resize=300%2C120&amp;ssl=1 300w, https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2014\/05\/blogoverrideregistry.png?resize=360%2C144&amp;ssl=1 360w\" sizes=\"(max-width: 660px) 100vw, 660px\" data-recalc-dims=\"1\" \/><\/a><\/p>\n<p>Restart you IDE, and from now on,\u00c2\u00a0Visual Assist will append override to\u00c2\u00a0the signatures of your\u00c2\u00a0virtual methods.<\/p>\n<p><em>This article was contributed by\u00c2\u00a0Manuel Maier,\u00c2\u00a0student at\u00c2\u00a0Hochschule der Medien Stuttgart, Germany.<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The C++11 standard has been approved and C++14 is around the corner. These\u00c2\u00a0new standards define a lot of interesting language features, one of them being support for the\u00c2\u00a0override identifier. You can append &#8220;override&#8221; to a&#8230;<\/p>\n","protected":false},"author":66190671,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_coblocks_attr":"","_coblocks_dimensions":"","_coblocks_responsive_height":"","_coblocks_accordion_ie_support":"","_jetpack_newsletter_access":"","_jetpack_newsletter_tier_id":0,"footnotes":""},"categories":[672],"tags":[],"class_list":["post-685","post","type-post","status-publish","format-standard","hentry","category-tips-and-tricks"],"aioseo_notices":[],"jetpack_featured_media_url":"","jetpack_likes_enabled":true,"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/pfhqii-b3","amp_enabled":true,"_links":{"self":[{"href":"https:\/\/stage.wholetomato.com\/blog\/wp-json\/wp\/v2\/posts\/685","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/stage.wholetomato.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/stage.wholetomato.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/stage.wholetomato.com\/blog\/wp-json\/wp\/v2\/users\/66190671"}],"replies":[{"embeddable":true,"href":"https:\/\/stage.wholetomato.com\/blog\/wp-json\/wp\/v2\/comments?post=685"}],"version-history":[{"count":3,"href":"https:\/\/stage.wholetomato.com\/blog\/wp-json\/wp\/v2\/posts\/685\/revisions"}],"predecessor-version":[{"id":802,"href":"https:\/\/stage.wholetomato.com\/blog\/wp-json\/wp\/v2\/posts\/685\/revisions\/802"}],"wp:attachment":[{"href":"https:\/\/stage.wholetomato.com\/blog\/wp-json\/wp\/v2\/media?parent=685"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/stage.wholetomato.com\/blog\/wp-json\/wp\/v2\/categories?post=685"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/stage.wholetomato.com\/blog\/wp-json\/wp\/v2\/tags?post=685"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}