Sealed classes - would you want them in D?
KingJoffrey
KingJoffrey at KingJoffrey.com
Tue May 15 15:05:45 UTC 2018
On Tuesday, 15 May 2018 at 14:34:07 UTC, bachmeier wrote:
>
> I think I'm missing something. Why is it a problem that you can
> do this? How do other languages prevent you from doing it?
C# example (silly, but it demonstrates the point).
The problem is not so much D, but that C++/Java/C# programmers,
and many from other languages (Go, Rust....) will expect private
to mean private...not private..depending on....
They will expect the interface they defined, to be respected.
Then they'll start asking..wtf!@$#? .. and end up in long
threads like this one, trying to work out why the world is upside
down (or seems like it).
And don't get me started on public being the default in D ..
cause at some point..I gotta get some sleep.
--------------
public class Program
{
public static void Main(string[] args)
{
Person p = new Person();
//p.name = "King Joffrey"; // dude. this is private!
}
}
public class Person
{
private string name;
public string getName() { return name; }
}
---------------
More information about the Digitalmars-d
mailing list