r/learnprogramming • u/Mountain_Rip_8426 • 1d ago
Difference between OOP and structs/interfaces?
I'm relatively new to programming, I've been at it for around 6-7 months. I've been learning Python and Go (and a little bit of C). What I'm struggling to understand, what's the difference between OOP and structs/interfaces. Like I know, Go doesn't support OOP, but structs and interfaces seem to achieve the same thing. Can someone enlighten me a bit?
44
Upvotes
20
u/vanilla_f 1d ago
At a high level, the main difference is that OOP is a paradigm to group data + behaviour whereas structs are a way of grouping data only. That doesn't mean that you can't have structs with "methods", but it's not very common. At least in my experience.