Questions tagged as 'encapsulamento'

4
answers

Getters and setters are an illusion of encapsulation?

It is common to teach that it is right to leave class attributes private and to create getters and setters for them, all because of encapsulation. Is not this the same thing as leaving everything public, since you can change and...
asked by 21.07.2014 / 12:57
3
answers

When to use Setters and Getters?

I'm studying OOP and in the encapsulation part I have a question about when to use getters and setters , besides being able to validate the parameter passed, what is the utility of using ? I could just "get" the given by __construct...
asked by 12.12.2014 / 07:50
1
answer

Encapsulation and Java Access Modifiers

A very simple question: Given this class: public class User { private String nome; //get/set public boolean fazQualquerCoisa(){ **duvida**.equals("algumacoisa"); } } Within the method Does AnyCase () , should I access the n...
asked by 05.05.2015 / 16:36
2
answers

What is the relationship between encapsulation and polymorphism?

A few days ago, I was talking to a friend about Java, and asked what part of the subject they were studying. So he replied that they were starting their studies on inheritance. As they were long overdue, I asked how they suddenly jumped to in...
asked by 22.06.2017 / 19:26
2
answers

How to customize the getter in Kotlin?

When we create a variable of type val , in the case of Java, only getter is created in relation to it. Different when a variable of type var is created, in which getter and setter is created. Here is an example:...
asked by 10.08.2017 / 15:43
1
answer

Observer can be considered a break in encapsulation?

Observer uses abstraction and interfaces . Let's suppose that a Observer "watches" the changes of state of certain classe and informs them to another external agent, we can consider this a break of encapsulation, since...
asked by 15.09.2016 / 16:25
1
answer

Why hide the implementation of a class?

This is the concept that I have tried hard to understand, but I have never fully achieved it. I'll take this excerpt from a Deitel book to illustrate:    It is better software engineering to define member functions outside the   class defi...
asked by 10.09.2017 / 16:30
1
answer

Object-oriented PHP tunneling

I have two models User and Post . When editing a post , I want to know if the user is the post author (the post has a user_id authorize editing. If I have a method inside the Post class that receives a User...
asked by 29.08.2018 / 17:31
1
answer

How to send / encapsulate a file in an .apk to use in the app installation?

I have an .xls file that I would like to encapsulate next to the apk so that at the time of installing the app it uses that file to populate a database. How to do?     
asked by 24.04.2014 / 21:51
4
answers

In Object Orientation, does an inheritance violate the encapsulation?

Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides , write the following statement: "... inheritance violates the encapsulation." Below is the paragraph that contains this statement:    " ... class inheritance also has some...
asked by 22.03.2016 / 19:36