Syntax | Simple, dynamic typing | Strict, static typing | Complex, static typing | Clean, static typing | Flexible, dynamic typing |
---|
Memory Management | Automatic (Garbage collection) | Automatic (Garbage collection) | Manual or automatic (RAII, smart pointers) | Automatic (Garbage collection) | Automatic (Garbage collection) |
---|
Encapsulation | Convention via underscore/private | Explicit private/public/protected | Explicit private/public/protected | Explicit private/public/protected | Via closures and private fields (#) |
---|
Polymorphism | Supported via method overriding | Supported via overriding & interfaces | Supported via virtual functions | Supported via virtual methods and interfaces | Supported via prototype chaining and method overriding |
---|
Inheritance | Single and multiple inheritance | Single inheritance, interfaces | Multiple inheritance supported | Single inheritance, multiple interfaces | Prototype-based inheritance |
---|
Abstraction | Supported via abstract base classes and interfaces (via ABC module) | Supported via abstract classes and interfaces | Supported via abstract classes and pure virtual functions | Supported via abstract classes and interfaces | Achieved through prototypes and ES6 classes |
---|
Access Modifiers | No strict enforcement; convention only (_ or __ ) | Strict enforcement (private, protected, public) | Strict enforcement (private, protected, public) | Strict enforcement (private, protected, internal, public) | Limited; public by default, private via # or closure |
---|
Multiple Inheritance | Supported | Not supported for classes; allowed via interfaces | Fully supported | Not supported for classes; allowed via interfaces | Not supported; prototypal inheritance used instead |
---|
Method Overloading | Not natively supported; can be mimicked | Supported | Supported | Supported | Not supported natively |
---|