Friday afternoon C trivia:

Nov 27, 2009 40 Replies

Ah, okay.

When dealing with single objects, this can be approximated in C++ by passing an object with virtual functions. For arrays, Ada (or Haskell...) wins by not requiring an individual vptr for each object, but just one for everything.

In its simplest form, Generics are just a type system feature, not a runtime feature. You pass a pointer to an object in, you get a pointer to an object of the same type out, the code inbetween doesn't look at it. If I recall correctly, that's how Java does it. I'd love to see that in C++.

Stefan

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required