4

No abstract classes and no 'protected' accessibility modifier in Swift.

Comments
  • 0
    As for example ?
  • 0
    @dder What do you mean?

    For example in C# and Java, you can declare abstract classes by prepending the keyword 'abstract' to a class.
    Abstract classes cannot have instances. But subclasses of abstract classes can.
    You can use abstract classes as contracts (like interfaces) which also have default implementations for some methods.

    Protected is present in C++, Java and C#. Protected members of classes can only be accessed by the class itself and by subclasses. Which is nice to have if you want to keep some implementation details accessible between class hierarchies but hidden from "outside".

    Abstract classes and protected members do play together well.
  • 1
    Dang, my bad, or a bug, wanted to comment that on another rant I didn’t understand.
  • 0
  • 0
    @Lensflare that one here, if you want to follow https://devrant.com/rants/3735603/...
  • 1
    I did see that rant and find it interesting but I also can't follow what higher kinded types are 😄
  • 0
    @Lensflare Cheers on that!
Add Comment