Any point using AbstractMesh in signature of methods that are only fed with Mesh objects?

I am getting familiar with a code base where AbstractMesh is extensively used in method signatures, but where those methods are only fed with Mesh objects. In other words, one could replace all AbstractMesh occurrences with Mesh, and the code would still work.

Except for a hypothetical future use case where a custom mesh class deriving from AbstractMesh would be used as method parameter, do you see any other reason for using AbstractMesh in the current code base? Performance maybe? Thanks!

This is javascript! no performance gained from using classes, there are technically no classes in es5 :slight_smile:

The reason for using abstractmesh over mesh is the same as in any other architecture. We have objects that are not meshes, but abstract meshes. Take InstancedMesh for example. It extends AbstractMesh. it doesn’t have the functionality of a mesh, but it does have the functionality of an abstract mesh so that you can use it wherever an abstract mesh is enough. Classic OOP :slight_smile:

1 Like

Thanks Raanan.
My “hypothetical future use case” was an attempted allusion to “classic OOP”, so I guess that’s all there is to it. :slight_smile:
And the code is written in TypeScript, but I suppose that shouldn’t make any difference in terms of runtime performance.

1 Like