First time at GK Digital?

GK Digital is an online, collaborative learning platform built from the ground up to be a superior learning experience on the web. It is self-paced and supported by instructors and peers. GK Digital is professional training in the 21st century, from Global Knowledge.
Task: Prevent errors and create better user-defined types by using const
Tags:
C++

The concept of constant appears in many programming languages. Most programmers are familiar with constant data; for example, a math library could include a symbolic constant for PI while a unit-conversion library might provide constants for the conversion factors.

The advantages of using constants are well known: It is easier to reason about the behavior of a block of code if you are sure some values will not change.

  • The compiler can help you write correct code by checking to make sure no attempt is made to change a constant.
  • Multiple threads can read a constant value without worrying about conflicting write operations.

The C++ language uses the keyword const to indicate a constant. C++ has an extremely rich notion of constant that extends far beyond the simple case of symbolic constant. In C++, many things can be marked const:

  • local variables
  • global variables
  • function parameters
  • member functions

In this task, you will explore several of the most important uses of constants in C++. You will experiment with constant objects, constant pointers and references, implement bitwise and semantic const, and code a class that is const-correct.

System.InvalidOperationException: The model item passed into the dictionary is of type 'LearningLine.Interface.ICourse[]', but this dictionary requires a model item of type 'LearningLine.Mongo.Course[]'. at System.Web.Mvc.ViewDataDictionary`1.SetModel(Object value) at System.Web.Mvc.ViewDataDictionary..ctor(ViewDataDictionary dictionary) at System.Web.Mvc.WebViewPage`1.SetViewData(ViewDataDictionary viewData) at RazorGenerator.Mvc.PrecompiledMvcView.Render(ViewContext viewContext, TextWriter writer) at System.Web.Mvc.HtmlHelper.RenderPartialInternal(String partialViewName, ViewDataDictionary viewData, Object model, TextWriter writer, ViewEngineCollection viewEngineCollection) at System.Web.Mvc.Html.PartialExtensions.Partial(HtmlHelper htmlHelper, String partialViewName, Object model, ViewDataDictionary viewData) at System.Web.Mvc.Html.PartialExtensions.Partial(HtmlHelper htmlHelper, String partialViewName, Object model) at ASP._Views_Tasks_ShowPublic_cshtml.Execute()

Preview any course on GK Digital for free.

Just choose a course from our catalog and then press preview course for free.