4 ms·
A class is a module/namespace. You can make a class just to have functions in it.
by MagicMoonlight 3y ago
A class is a module/namespace. You can make a class just to have functions in it.
- _gabe_ 3y agoIt’s not though. In lots of languages a namespace can span multiple files, whereas a class must be declared in a single file[0][1]. Modules can usually contain a collection of functions and classes. And namespaces can also contain multiple classes/structure/functions and sometimes modules depending on the language[2]. [0]: https://www.typescriptlang.org/docs/handbook/namespaces-and-modules.html https://www.typescriptlang.org/docs/handbook/namespaces-and-... [1]: https://learn.microsoft.com/en-us/cpp/cpp/namespaces-cpp?view=msvc-170 https://learn.microsoft.com/en-us/cpp/cpp/namespaces-cpp?vie... [2]: https://learn.microsoft.com/en-us/dotnet/fsharp/language-reference/namespaces https://learn.microsoft.com/en-us/dotnet/fsharp/language-ref...