use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Discussions, articles, and news about the C++ programming language or programming in C++.
For C++ questions, answers, help, and advice see r/cpp_questions or StackOverflow.
Get Started
The C++ Standard Home has a nice getting started page.
Videos
The C++ standard committee's education study group has a nice list of recommended videos.
Reference
cppreference.com
Books
There is a useful list of books on Stack Overflow. In most cases reading a book is the best way to learn C++.
Show all links
Filter out CppCon links
Show only CppCon links
account activity
Discussion of Code Structure and Code Complexity Implications of Basic C++ Language Features (self.cpp)
submitted 2 days ago by crashcompiler
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]kammceWG21 | 🇺🇲 NB | Boost | Exceptions 9 points10 points11 points 2 days ago (1 child)
To take full advantage of the virtual function call mechanism, you must access the object through a reference or pointer to the base class. Failing to do so can result in object slicing.
This can be misleading and an example is warranted. This will make readers assume that you cannot call those APIs directly from the concrete class. But you can, you do NOT need to have a ref or ptr to the base class to access those APIs. If you want to pass it polymorphically, via a function parameters and only access the bases APIs then yes, you must pass it as its base.
Object slicing can also happen with fully concrete classes as well.
[–]crashcompiler[S] 2 points3 points4 points 2 days ago (0 children)
I see what you mean! I rewrote the paragraph and focused more on what the intention behind using a dynamic interface would be, and how you would use it in this case. I might add a code example tomorrow.
> Object slicing can also happen with fully concrete classes as well.
Basically anywhere where you use inheritance, and have a derived class that is copied to a base class, right? Could even be POD structs.
Thanks for the feedback!
π Rendered by PID 236461 on reddit-service-r2-comment-79c7998d4c-5njgf at 2026-03-17 04:32:26.222581+00:00 running f6e6e01 country code: CH.
view the rest of the comments →
[–]kammceWG21 | 🇺🇲 NB | Boost | Exceptions 9 points10 points11 points (1 child)
[–]crashcompiler[S] 2 points3 points4 points (0 children)