1

My question arises from the answer provided in this thread

How can I simulate OO-style polymorphism in C?

Where it is mentioned:

You should also encapsulate structures instantiation and initialisation in functions (this is equivalent to a C++ constructor) and deletion (destructor in C++).

To what it refers with encapsulate structures instantiation? How can I do it?

Community
  • 1
  • 1
cheroky
  • 755
  • 1
  • 8
  • 16
  • 1
    This term sounds a bit ambiguous to me, I think you should ask them by leaving a comment under their answer. But I assume it means "to hide malloc() call into a function". For example, fopen() does it. (It works especially well with opaque pointers.) – HolyBlackCat Jan 09 '17 at 18:15

0 Answers0