Most programming paradigms build on what came before and OO is no
exception. I think that some people tend to forget that we were
programming successfully long before OO existed, and that not all
programming concepts are OO concepts. By the comment that Student made,
I thought that he could use a reminder that OO is not the beginning and
end of programming.
We discuss C++. Yes, for example class-based is one style of OOP,
other style of OOP is the one that uses prototypes and clones of such
prototypes (like Javascript) and there may be even more styles.
However here we discuss C++ OOP so here we expect it to be class-
based.
C is procedural language that deals with low level resource management
explicitly uses single exit (structured programming) idiom to ease
that task. Some OOP languages may use closures or finalizers for
recycling non-memory resources by their OOP engine. With C++ most of
us expect RAII (OOP) idiom to be used to let destructors to deal with
releasing resources instead of explicit resource management of C. That
is most robust and simple way.
You may use single exit idiom as well in C++, since most C compiles
with C++ compiler. It lacks the effect since there are exceptions in C+
+ language that sort of break it. It also lacks the purpose if you
anyway have to bind the resources to objects with RAII idiom.
[...]
Looking at the responses to that comment, I'm beginning to wonder why
several others want to insist that a "single exit vs multiple exit"
discussion relates to the object-oriented paradigm.
Classification is of less interest for me, but i am still curious. To
what concept of what paradigm that RAII belongs then? I suggested
there above encapsulation and not module-level but object-level
encapsulation ... so C++ style OOP.