Where, in an object oriented system should you, if at all, choose (C-style) structs over classes?

Posted by Anto on Programmers See other posts from Programmers or by Anto
Published on 2011-02-28T18:23:24Z Indexed on 2012/03/22 5:37 UTC
Read the original article Hit count: 185

C and most likely many other languages provide a struct keyword for creating structures (or something in a similar fashion). These are (at least in C), from a simplified point of view like classes, but without polymorphism, inheritance, methods, and so on.

Think of an object-oriented (or multi paradigm) language with C-style structs. Where would you choose them over classes? Now, I don't believe they are to be used with OOP as classes seem to replace their purposes, but I wonder if there are situations where they could be preferred over classes in otherwise object-oriented programs and in what kind of situations. Are there such situations?

© Programmers or respective owner

Related posts about design

Related posts about object-oriented