{"id":1844,"date":"2016-08-22T07:43:17","date_gmt":"2016-08-22T12:43:17","guid":{"rendered":"http:\/\/www.logikalsolutions.com\/wordpress\/?p=1844"},"modified":"2020-09-28T04:49:49","modified_gmt":"2020-09-28T09:49:49","slug":"c-11-and-qt-part-2-const","status":"publish","type":"post","link":"https:\/\/www.logikalsolutions.com\/wordpress\/information-technology\/c-11-and-qt-part-2-const\/","title":{"rendered":"C++ 11 and Qt &#8212; Part 2 const"},"content":{"rendered":"<p align=\"justify\">This really isn\u2019t a C++ 11 or Qt thing we need to discuss next. It is something which hoses every C\/C++ programmer at some point, especially if you are either tired or reading fast.<\/p>\n<p align=\"justify\"><strong>Where <em>const<\/em> is matters<\/strong><\/p>\n<pre>char txt[] = \"Red baby buggy bumpers\";\nchar *ptr = txt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \/\/ non-const pointer, non-const data\nconst char *ptr = txt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \/\/ non-const pointer, const data\nchar * const ptr = txt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \/\/ const pointer, non-const data\nconst char * const ptr = txt; \/\/ const pointer, const data<\/pre>\n<p align=\"justify\">The often forgotten rule is <em>const<\/em> to the left of * means what is pointed at is constant while <em>const<\/em> to the right of * means the pointer is constant. Even I get in a hurry and get burned by this. If you choose to work with the more advanced classes in Qt or wish to create your own delegates for things, you need to memorize this mantra and have this little post bookmarked.<\/p>\n<p align=\"justify\">Now that we have C++ 11 a good many of the class butchering we had to do in the past need not exist. Oh come on, if you have been coding in C++ for a while you have seen the enum hack.<\/p>\n<pre>class MyClass\n{\n&nbsp;&nbsp;&nbsp; enum { MAX_ENTRIES = 99};\n&nbsp;&nbsp;&nbsp; int entries[ MAX_ENTRIES];\n&nbsp;&nbsp;&nbsp; ...\n}<\/pre>\n<p align=\"justify\">Then the language moved on to the Texas Two Step. This required you declare a constant as static const in the class definition:<\/p>\n<pre>class MyOtherClass\n{\n&nbsp; static const double smoothing;\n&nbsp; ...\n};<\/pre>\n<p align=\"justify\">Then in the class implementation (.cpp) file you made this declaration:<\/p>\n<pre>const double MyOtherClass = 0.456;<\/pre>\n<p align=\"justify\">Finally! We can initialize variables in our class declarations.<\/p>\n<pre>#ifndef TEST2CLASS_H\n#define TEST2CLASS_H\n\n#include &lt;string&gt;\n\nclass Test2Class\n{\npublic:\n&nbsp;&nbsp;&nbsp; ~Test2Class();\n&nbsp;&nbsp; &nbsp;\n&nbsp;&nbsp;&nbsp; explicit Test2Class();\n&nbsp;&nbsp; &nbsp;\n&nbsp;&nbsp;&nbsp; explicit Test2Class( const std::string&amp; msg); \n&nbsp;&nbsp;&nbsp; explicit Test2Class( double ratio);\n&nbsp;&nbsp;&nbsp; explicit Test2Class( int kount);\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;\n&nbsp;&nbsp;&nbsp; std::string dumpValues();\n\n\nprivate:\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int m_kount=10;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; double m_ratio=3.45;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; std::string m_msg{\"default message\"};\n\n};\n\n#endif \/\/ TEST2CLASS_H<\/pre>\n<p align=\"justify\">While it may look unfamiliar to see values assigned during member variable declaration it makes things so much cleaner. Yes, we used to have constructors with default values but when we did you had to either provide every value in the list just to change the last one or you had to perform a multi-step construction by calling the constructor then N set methods to change the few values at the end. It was even worse if you needed multiple constructors because you had to replicate code or create a common shared method for each constructor to call. The final wrench in the gears was when a default value changed in a later release. This meant you had to search for all of those places where you passed in several default values just to change the one you needed to change.<\/p>\n<pre>#include \"Test2Class.h\"\n#include &lt;iostream&gt;\n#include &lt;sstream&gt;\n\nTest2Class::Test2Class( int kount)\n{\n&nbsp;&nbsp;&nbsp; m_kount = kount;\n&nbsp;&nbsp; &nbsp;\n&nbsp;&nbsp;&nbsp; std::cout &lt;&lt; \"Constructor (int): kount: \" &lt;&lt; m_kount &lt;&lt; \" ratio: \" &lt;&lt; m_ratio &lt;&lt; \" msg: \" &lt;&lt; m_msg &lt;&lt; std::endl;\n}\n\nTest2Class::Test2Class( double ratio)\n{\n&nbsp;&nbsp;&nbsp; m_ratio = ratio;\n&nbsp;&nbsp;&nbsp; std::cout &lt;&lt; \"Constructor (double): kount: \" &lt;&lt; m_kount &lt;&lt; \" ratio: \" &lt;&lt; m_ratio &lt;&lt; \" msg: \" &lt;&lt; m_msg &lt;&lt; std::endl;\n}\n\nTest2Class::Test2Class( const std::string&amp; msg)\n{\n&nbsp;&nbsp;&nbsp; m_msg = msg;\n&nbsp;&nbsp;&nbsp; std::cout &lt;&lt; \"Constructor (std::string): kount: \" &lt;&lt; m_kount &lt;&lt; \" ratio: \" &lt;&lt; m_ratio &lt;&lt; \" msg: \" &lt;&lt; m_msg &lt;&lt; std::endl;\n}\n\nTest2Class::~Test2Class()\n{\n}\n\n\nstd::string Test2Class::dumpValues()\n{\n&nbsp;&nbsp;&nbsp; std::string txt;\n&nbsp;&nbsp;&nbsp; std::stringstream txtStream( txt);\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;\n&nbsp;&nbsp;&nbsp; txtStream &lt;&lt; \"Kount: \" &lt;&lt; m_kount \n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;&lt; \" Ratio: \" &lt;&lt; m_ratio\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;&lt; \" Msg: \" &lt;&lt; m_msg;\n&nbsp;&nbsp;&nbsp; return txtStream.str();\n}<\/pre>\n<p align=\"justify\">Yes, there is a rule of thumb saying one should use : member_variable( param) on the constructor declaration for direct assignments. When a class has C++ 11 member initialization in the class definition I humbly suggest one avoids that particular rule of thumb.<\/p>\n<pre>#include \"Test2Class.h\"\n#include &lt;iostream&gt;\n\nint main(int argc, char **argv)\n{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Test2Class b( 16);\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Test2Class c( 3.1435);\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Test2Class d( \"new message\");\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; std::cout &lt;&lt; \"Values for b: \" &lt;&lt; b.dumpValues() &lt;&lt; std::endl;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; std::cout &lt;&lt; \"Values for c: \" &lt;&lt; c.dumpValues() &lt;&lt; std::endl;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; std::cout &lt;&lt; \"Values for d: \" &lt;&lt; d.dumpValues() &lt;&lt; std::endl;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return 0;\n}<\/pre>\n<p align=\"justify\">Running our program in the CodeLite IDE produces the following:<\/p>\n<pre>Constructor (int): kount: 16 ratio: 3.45 msg: default message\nConstructor (double): kount: 10 ratio: 3.1435 msg: default message\nConstructor (std::string): kount: 10 ratio: 3.45 msg: new message\nValues for b: Kount: 16 Ratio: 3.45 Msg: default message\nValues for c: Kount: 10 Ratio: 3.1435 Msg: default message\nValues for d: Kount: 10 Ratio: 3.45 Msg: new message\nPress ENTER to continue...<\/pre>\n<p align=\"justify\">&nbsp;I added the seemingly needless debug prints in the constructor as a lead in to our next post.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This really isn\u2019t a C++ 11 or Qt thing we need to discuss next. It is something which hoses every C\/C++ programmer at some point, especially if you are either tired or reading fast. Where const is matters char txt[] = &#8220;Red baby buggy bumpers&#8221;; char *ptr = txt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \/\/ non-const pointer, non-const data const char *ptr = txt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \/\/ non-const pointer, const data char * const ptr = txt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \/\/ const pointer, non-const data &hellip; <a title=\"C++ 11 and Qt &#8212; Part 2 const\" class=\"bnm-read-more\" href=\"https:\/\/www.logikalsolutions.com\/wordpress\/information-technology\/c-11-and-qt-part-2-const\/\"><span class=\"screen-reader-text\">C++ 11 and Qt &#8212; Part 2 const<\/span>Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[1182,912,1185],"class_list":["post-1844","post","type-post","status-publish","format-standard","hentry","category-information-technology","tag-c-11","tag-codelite","tag-member-initialization","bnm-entry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.6 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>C++ 11 and Qt -- Part 2 const &#8211; Logikal Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.logikalsolutions.com\/wordpress\/information-technology\/c-11-and-qt-part-2-const\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"C++ 11 and Qt -- Part 2 const &#8211; Logikal Blog\" \/>\n<meta property=\"og:description\" content=\"This really isn\u2019t a C++ 11 or Qt thing we need to discuss next. It is something which hoses every C\/C++ programmer at some point, especially if you are either tired or reading fast. Where const is matters char txt[] = &quot;Red baby buggy bumpers&quot;; char *ptr = txt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \/\/ non-const pointer, non-const data const char *ptr = txt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \/\/ non-const pointer, const data char * const ptr = txt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \/\/ const pointer, non-const data &hellip; C++ 11 and Qt &#8212; Part 2 constRead more\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.logikalsolutions.com\/wordpress\/information-technology\/c-11-and-qt-part-2-const\/\" \/>\n<meta property=\"og:site_name\" content=\"Logikal Blog\" \/>\n<meta property=\"article:published_time\" content=\"2016-08-22T12:43:17+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-09-28T09:49:49+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.logikalsolutions.com\\\/wordpress\\\/information-technology\\\/c-11-and-qt-part-2-const\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.logikalsolutions.com\\\/wordpress\\\/information-technology\\\/c-11-and-qt-part-2-const\\\/\"},\"author\":{\"name\":\"admin\",\"@id\":\"https:\\\/\\\/www.logikalsolutions.com\\\/wordpress\\\/#\\\/schema\\\/person\\\/b87acf3335e19871db8f4a1aca03736c\"},\"headline\":\"C++ 11 and Qt &#8212; Part 2 const\",\"datePublished\":\"2016-08-22T12:43:17+00:00\",\"dateModified\":\"2020-09-28T09:49:49+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.logikalsolutions.com\\\/wordpress\\\/information-technology\\\/c-11-and-qt-part-2-const\\\/\"},\"wordCount\":413,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.logikalsolutions.com\\\/wordpress\\\/#\\\/schema\\\/person\\\/c077f770ade13de7faaf616c3eac6842\"},\"keywords\":[\"C++ 11\",\"CodeLite\",\"member initialization\"],\"articleSection\":[\"Information Technology\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.logikalsolutions.com\\\/wordpress\\\/information-technology\\\/c-11-and-qt-part-2-const\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.logikalsolutions.com\\\/wordpress\\\/information-technology\\\/c-11-and-qt-part-2-const\\\/\",\"url\":\"https:\\\/\\\/www.logikalsolutions.com\\\/wordpress\\\/information-technology\\\/c-11-and-qt-part-2-const\\\/\",\"name\":\"C++ 11 and Qt -- Part 2 const &#8211; Logikal Blog\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.logikalsolutions.com\\\/wordpress\\\/#website\"},\"datePublished\":\"2016-08-22T12:43:17+00:00\",\"dateModified\":\"2020-09-28T09:49:49+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.logikalsolutions.com\\\/wordpress\\\/information-technology\\\/c-11-and-qt-part-2-const\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.logikalsolutions.com\\\/wordpress\\\/information-technology\\\/c-11-and-qt-part-2-const\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.logikalsolutions.com\\\/wordpress\\\/information-technology\\\/c-11-and-qt-part-2-const\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.logikalsolutions.com\\\/wordpress\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"C++ 11 and Qt &#8212; Part 2 const\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.logikalsolutions.com\\\/wordpress\\\/#website\",\"url\":\"https:\\\/\\\/www.logikalsolutions.com\\\/wordpress\\\/\",\"name\":\"Logikal Blog\",\"description\":\"For people with attention spans longer than a Tweet\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.logikalsolutions.com\\\/wordpress\\\/#\\\/schema\\\/person\\\/c077f770ade13de7faaf616c3eac6842\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.logikalsolutions.com\\\/wordpress\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/www.logikalsolutions.com\\\/wordpress\\\/#\\\/schema\\\/person\\\/c077f770ade13de7faaf616c3eac6842\",\"name\":\"seasoned_geek\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/ae9adac14079d84b909e635d7af986fe4568053af4fd9ff8d4109298c392493e?s=96&d=mm&r=r\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/ae9adac14079d84b909e635d7af986fe4568053af4fd9ff8d4109298c392493e?s=96&d=mm&r=r\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/ae9adac14079d84b909e635d7af986fe4568053af4fd9ff8d4109298c392493e?s=96&d=mm&r=r\",\"caption\":\"seasoned_geek\"},\"logo\":{\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/ae9adac14079d84b909e635d7af986fe4568053af4fd9ff8d4109298c392493e?s=96&d=mm&r=r\"},\"description\":\"Roland Hughes started his IT career in the early 1980s. He quickly became a consultant and president of Logikal Solutions, a software consulting firm specializing in OpenVMS application and C++\\\/Qt touchscreen\\\/embedded Linux development. Early in his career he became involved in what is now called cross platform development. Given the dearth of useful books on the subject he ventured into the world of professional author in 1995 writing the first of the \\\"Zinc It!\\\" book series for John Gordon Burke Publisher, Inc. A decade later he released a massive (nearly 800 pages) tome \\\"The Minimum You Need to Know to Be an OpenVMS Application Developer\\\" which tried to encapsulate the essential skills gained over what was nearly a 20 year career at that point. From there \\\"The Minimum You Need to Know\\\" book series was born. Three years later he wrote his first novel \\\"Infinite Exposure\\\" which got much notice from people involved in the banking and financial security worlds. Some of the attacks predicted in that book have since come to pass. While it was not originally intended to be a trilogy, it became the first book of \\\"The Earth That Was\\\" trilogy: Infinite Exposure Lesedi - The Greatest Lie Ever Told John Smith - Last Known Survivor of the Microsoft Wars When he is not consulting Roland Hughes posts about technology and sometimes politics on his blog. He also has regularly scheduled Sunday posts appearing on the Interesting Authors blog.\",\"sameAs\":[\"https:\\\/\\\/theminimumyouneedtoknow.com\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.logikalsolutions.com\\\/wordpress\\\/#\\\/schema\\\/person\\\/b87acf3335e19871db8f4a1aca03736c\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/168fb2539f8db5d41fe93ae7707d04fbfab3d518cd2603e8066217896887745a?s=96&d=mm&r=r\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/168fb2539f8db5d41fe93ae7707d04fbfab3d518cd2603e8066217896887745a?s=96&d=mm&r=r\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/168fb2539f8db5d41fe93ae7707d04fbfab3d518cd2603e8066217896887745a?s=96&d=mm&r=r\",\"caption\":\"admin\"},\"url\":\"https:\\\/\\\/www.logikalsolutions.com\\\/wordpress\\\/author\\\/admin\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"C++ 11 and Qt -- Part 2 const &#8211; Logikal Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.logikalsolutions.com\/wordpress\/information-technology\/c-11-and-qt-part-2-const\/","og_locale":"en_US","og_type":"article","og_title":"C++ 11 and Qt -- Part 2 const &#8211; Logikal Blog","og_description":"This really isn\u2019t a C++ 11 or Qt thing we need to discuss next. It is something which hoses every C\/C++ programmer at some point, especially if you are either tired or reading fast. Where const is matters char txt[] = \"Red baby buggy bumpers\"; char *ptr = txt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \/\/ non-const pointer, non-const data const char *ptr = txt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \/\/ non-const pointer, const data char * const ptr = txt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \/\/ const pointer, non-const data &hellip; C++ 11 and Qt &#8212; Part 2 constRead more","og_url":"https:\/\/www.logikalsolutions.com\/wordpress\/information-technology\/c-11-and-qt-part-2-const\/","og_site_name":"Logikal Blog","article_published_time":"2016-08-22T12:43:17+00:00","article_modified_time":"2020-09-28T09:49:49+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"Written by":"admin","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.logikalsolutions.com\/wordpress\/information-technology\/c-11-and-qt-part-2-const\/#article","isPartOf":{"@id":"https:\/\/www.logikalsolutions.com\/wordpress\/information-technology\/c-11-and-qt-part-2-const\/"},"author":{"name":"admin","@id":"https:\/\/www.logikalsolutions.com\/wordpress\/#\/schema\/person\/b87acf3335e19871db8f4a1aca03736c"},"headline":"C++ 11 and Qt &#8212; Part 2 const","datePublished":"2016-08-22T12:43:17+00:00","dateModified":"2020-09-28T09:49:49+00:00","mainEntityOfPage":{"@id":"https:\/\/www.logikalsolutions.com\/wordpress\/information-technology\/c-11-and-qt-part-2-const\/"},"wordCount":413,"commentCount":0,"publisher":{"@id":"https:\/\/www.logikalsolutions.com\/wordpress\/#\/schema\/person\/c077f770ade13de7faaf616c3eac6842"},"keywords":["C++ 11","CodeLite","member initialization"],"articleSection":["Information Technology"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.logikalsolutions.com\/wordpress\/information-technology\/c-11-and-qt-part-2-const\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.logikalsolutions.com\/wordpress\/information-technology\/c-11-and-qt-part-2-const\/","url":"https:\/\/www.logikalsolutions.com\/wordpress\/information-technology\/c-11-and-qt-part-2-const\/","name":"C++ 11 and Qt -- Part 2 const &#8211; Logikal Blog","isPartOf":{"@id":"https:\/\/www.logikalsolutions.com\/wordpress\/#website"},"datePublished":"2016-08-22T12:43:17+00:00","dateModified":"2020-09-28T09:49:49+00:00","breadcrumb":{"@id":"https:\/\/www.logikalsolutions.com\/wordpress\/information-technology\/c-11-and-qt-part-2-const\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.logikalsolutions.com\/wordpress\/information-technology\/c-11-and-qt-part-2-const\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.logikalsolutions.com\/wordpress\/information-technology\/c-11-and-qt-part-2-const\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.logikalsolutions.com\/wordpress\/"},{"@type":"ListItem","position":2,"name":"C++ 11 and Qt &#8212; Part 2 const"}]},{"@type":"WebSite","@id":"https:\/\/www.logikalsolutions.com\/wordpress\/#website","url":"https:\/\/www.logikalsolutions.com\/wordpress\/","name":"Logikal Blog","description":"For people with attention spans longer than a Tweet","publisher":{"@id":"https:\/\/www.logikalsolutions.com\/wordpress\/#\/schema\/person\/c077f770ade13de7faaf616c3eac6842"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.logikalsolutions.com\/wordpress\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/www.logikalsolutions.com\/wordpress\/#\/schema\/person\/c077f770ade13de7faaf616c3eac6842","name":"seasoned_geek","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/ae9adac14079d84b909e635d7af986fe4568053af4fd9ff8d4109298c392493e?s=96&d=mm&r=r","url":"https:\/\/secure.gravatar.com\/avatar\/ae9adac14079d84b909e635d7af986fe4568053af4fd9ff8d4109298c392493e?s=96&d=mm&r=r","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/ae9adac14079d84b909e635d7af986fe4568053af4fd9ff8d4109298c392493e?s=96&d=mm&r=r","caption":"seasoned_geek"},"logo":{"@id":"https:\/\/secure.gravatar.com\/avatar\/ae9adac14079d84b909e635d7af986fe4568053af4fd9ff8d4109298c392493e?s=96&d=mm&r=r"},"description":"Roland Hughes started his IT career in the early 1980s. He quickly became a consultant and president of Logikal Solutions, a software consulting firm specializing in OpenVMS application and C++\/Qt touchscreen\/embedded Linux development. Early in his career he became involved in what is now called cross platform development. Given the dearth of useful books on the subject he ventured into the world of professional author in 1995 writing the first of the \"Zinc It!\" book series for John Gordon Burke Publisher, Inc. A decade later he released a massive (nearly 800 pages) tome \"The Minimum You Need to Know to Be an OpenVMS Application Developer\" which tried to encapsulate the essential skills gained over what was nearly a 20 year career at that point. From there \"The Minimum You Need to Know\" book series was born. Three years later he wrote his first novel \"Infinite Exposure\" which got much notice from people involved in the banking and financial security worlds. Some of the attacks predicted in that book have since come to pass. While it was not originally intended to be a trilogy, it became the first book of \"The Earth That Was\" trilogy: Infinite Exposure Lesedi - The Greatest Lie Ever Told John Smith - Last Known Survivor of the Microsoft Wars When he is not consulting Roland Hughes posts about technology and sometimes politics on his blog. He also has regularly scheduled Sunday posts appearing on the Interesting Authors blog.","sameAs":["https:\/\/theminimumyouneedtoknow.com"]},{"@type":"Person","@id":"https:\/\/www.logikalsolutions.com\/wordpress\/#\/schema\/person\/b87acf3335e19871db8f4a1aca03736c","name":"admin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/168fb2539f8db5d41fe93ae7707d04fbfab3d518cd2603e8066217896887745a?s=96&d=mm&r=r","url":"https:\/\/secure.gravatar.com\/avatar\/168fb2539f8db5d41fe93ae7707d04fbfab3d518cd2603e8066217896887745a?s=96&d=mm&r=r","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/168fb2539f8db5d41fe93ae7707d04fbfab3d518cd2603e8066217896887745a?s=96&d=mm&r=r","caption":"admin"},"url":"https:\/\/www.logikalsolutions.com\/wordpress\/author\/admin\/"}]}},"_links":{"self":[{"href":"https:\/\/www.logikalsolutions.com\/wordpress\/wp-json\/wp\/v2\/posts\/1844","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.logikalsolutions.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.logikalsolutions.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.logikalsolutions.com\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.logikalsolutions.com\/wordpress\/wp-json\/wp\/v2\/comments?post=1844"}],"version-history":[{"count":0,"href":"https:\/\/www.logikalsolutions.com\/wordpress\/wp-json\/wp\/v2\/posts\/1844\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.logikalsolutions.com\/wordpress\/wp-json\/wp\/v2\/media?parent=1844"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.logikalsolutions.com\/wordpress\/wp-json\/wp\/v2\/categories?post=1844"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.logikalsolutions.com\/wordpress\/wp-json\/wp\/v2\/tags?post=1844"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}