In my opinion there are two main disadvantages of C++:
- lack of local functions (called sometimes "nested")
- lack of pointers to class method ("delegates")
Ad 1.
GotW #58 shows use of
local class to simulate local functions, but this is partial solution - class has no direct access to objects existing in outer scope. This force programmer to manage many things manually (more work) and is place of potential error.
Ad 2. Borland has
__closure extension (no portable code), there are some portable libraries that does the trick. But everything is not compatible with each other, we can forget about real code reuse.
Brak komentarzy:
Prześlij komentarz