r/learnprogramming • • Apr 05 '22

Name one programming/comp sci concept you never understood and if you understand it, try to explain it to them

Name a programming concept such as virtual functions, pointers, certain algorithms, etc that you always had a hard time understanding and why.

Someone else who reads yours and does understand it, try to explain it to them to help them learn

1.6k Upvotes

738 comments sorted by

View all comments

14

u/Sedowa Apr 05 '22

I'm reading through stuff about virtual functions and class pointers to them and I've found I just don't understand why it has to be so complicated. Seems it would be a lot easier to just avoid using them and code around it but maybe there's a performance reason for it.

Same with lambda functions. It was explained to me as being a function that just gets run once so doesn't need a fancy definition but seems to mostly just make readability harder for not a lot of gain. Once again this could just be a performance thing and maybe it helps with larger applications rather than the smaller ones used in teaching material.

It's hard to wrap my mind around the point of it all.

14

u/[deleted] Apr 05 '22

[removed] — view removed comment

5

u/Sedowa Apr 05 '22

I hadn't even thought about using a lambda as a parameter. That actually makes a lot of sense.

Still working through the section for class inheritence so hopefully by the end it makes more sense what to use and where. I suppose I do get it but it's gonna be hard to remember all the rules.

5

u/faceplanted Apr 05 '22

Parameters are I think what they're most used for by far.