Posts by user18612 • 500 points
3 posts
-
3
votes1
answer64
viewsA: Why use nested classes in Ruby?
Nested classes are for when you need a class that does not need or should not be accessible outside the context of another class. class Comunidade class Pessoa def diga_ola 'Olá!' end end def…
-
16
votes2
answers3148
viewsQ: Why does everyone hate multiple inheritance in C++ and what’s your difference to mixins?
I’ve always heard that multiple inheritance in C++ is chaos. Why? It wouldn’t be technically the same thing as using mixins in languages such as Ruby? And what is this abstract class of Java? It’s a…
-
29
votes3
answers660
viewsQ: Should we validate function parameters?
In languages like Java, method parameters are "validated" in the build (at least the type): public void facaAlgo(String str) { // ... } // em algum outro lugar: int i = 2; this.facaAlgo(i); // erro…