You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -23,14 +28,15 @@ Largely speaking, there are two types of inheritance:
23
28
- Implementation inheritance
24
29
- Interface inheritance
25
30
26
-
The difference between these? One used to inherit a full implementation and the other one has the word `virtual` involved.
31
+
The difference between these? One used to inherit a full implementation and the other one is used to implement a provided interface and is used to enable object oriented programming (OOP) with C++.
27
32
28
-
Today we only cover the basics of how inheritance works and focus on the implementation inheritance only. But don't worry, we will cover the interface inheritance in the coming lectures very soon.
33
+
It is important to [keep these different styles of inheritance separate](https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#c129-when-designing-a-class-hierarchy-distinguish-between-implementation-inheritance-and-interface-inheritance) (for more details on this, please see the C++ Core Guidelines take on this) and some, like the Google C++ Code Style suggest to go as far as to avoid implementation inheritance altogether.
29
34
35
+
Today we only cover the implementation inheritance and I hope that I will be able to convince you that you probably should not use it very often.
30
36
<!-- intro -->
31
37
32
38
## What is implementation inheritance for
33
-
Honestly, as a design concept on its own it is not very useful and we will mostly use it as a start into understanding inheritance because the concept is quite simple. Although there are a couple of pretty advanced use cases that it enables like, for example, the [Curiously Recurring Template Pattern (aka CRTP)](https://en.wikipedia.org/wiki/Curiously_recurring_template_pattern).
39
+
Honestly, as a design concept on its own it is not very useful and we will mostly use it as a start into understanding inheritance because the concept is quite simple. Although there are a couple of pretty advanced use cases that it enables like, for example, the [Curiously Recurring Template Pattern (aka CRTP)](https://en.wikipedia.org/wiki/Curiously_recurring_template_pattern) or [tag dispatch](https://en.cppreference.com/w/cpp/language/sfinae).
34
40
35
41
Essentially the implementation inheritance technically allows us to avoid repeating ourselves and save us some typing. In reality its use cases are pretty limited which we will see at the end of this video.
0 commit comments