composição

Is it correct to give greater preference to composition than inheritance?

I have read in several articles and books of Designer patterns the expression Prefira composição em vez de herança. I believe ... ecify a right time to use them? Following the opinion of the title, the best combination would be composition + interface ?

Inheritance in Object-Oriented Programming

I was reading this article today and came across the following statement: "inheritance refers to the ability of an obje ... object of another class is instantiated within the parent object's own class), right? Can anyone supplement this statement?

Associative class with double dependency

I was searching the internet and saw this way of making association between Java classes. Is it correct to make this type of ... private Time horaAula; } public class Materia { private int codigo; private List<AlunoMateria> alunos; }

How do you model a role in object orientation?

How do you normally model a role (role) in object orientation? Is by means of a composition, correct? For example, to model ... y problem is Cliente having a Pessoa and not the other way around... at least the opposite is not necessary at first. empty .

Questions about class composition or inheritance

I have some doubts in this composition between ClienteJuridico and ClienteFisico with NotaFiscal. I gave a survey and saw tha ... ther, in case it would be the composition, but how could I inherit the attributes of these classes in the Class NotaFiscal?