The Theoretical base is crucial for every successful programmer. It is an unwritten fact that mere mortals can't cope with the variety of concepts in C++.
Let's try to categorize important concepts every C++ programmer needs to know about.
Besides the fundamental things like variables, functions, arrays, it is really crucial to freely operate with pointers and references.
C++ doesn't have automatic garbage collection, which forces programmers to understand low level details about memory management. In this context, knowing pointers is a must.
For example, you should understand what the following code does:
Compared to Java/C#, a confusing moment in C++ is that variables and members of type T actually hold T objects, rather than references to T.
An important role play rvalue and lvalue variables. With the new C++ standard (C++11 and beyond), move semantics come into play, allowing to write even more efficient code.
Finally, you can't code complex projects if you are not familiar with classes and objects, object construction/destruction procedures, and similar.
More in-depth knowledge of Object-Oriented C++ concepts are a must, knowing how virtual functions work, what is a virtual table pointer (sometimes referred as vtable, vptr) and how would you describe the difference between static and dynamic polymorphism.
Speaking of static polymorphism, templates come to mind.
Let's take a look at this classic example of compile-time factorial calculation using templates:
Understanding the code above will speak of your good experience and level in C++.
Getting to know the templates will come naturally if you will dive deeper into the Standard Template Library, STL. You should know the differences between std::vector
While knowing common containers and algorithms from the STL is a must for mid level C++ developers, a senior developer should also be familiar with inner details of those algorithms/containers implementations.
Here's a common C++ interview question you might encounter in your career: "why is the time complexity of std::distance() function O(n) for std::list iterators, and O(1) for std::vector iterators?"
Senior developers should understand inner details of OOP in C++, such as interface classes and the role of pure virtual functions.
|Liked Article? Please Buy me a Tea 😭|