Questions tagged as 'encapsulamento'

1
answer

I could not quite understand the encapsulation in OOP [duplicate]

I did a programming logic course and now I'm doing logic OO, but it came in the encapsulation part and I'm having a little trouble understanding. What would it be and how is it used?     
asked by 25.09.2017 / 02:31
4
answers

In inheritance with private attributes, does not the child class take its attributes from the parent class?

The devmedia article says that the private modifier does not give access to their attributes in their daughter classes. It has a table with the modifiers. In inheritance with private attributes, does not the child class take its attr...
asked by 15.01.2016 / 19:10
3
answers

Why can not (easily) hide private members?

Concealing implementation is one of the keys to good modern software engineering, and crucial in code reuse. Why then in c ++ it is not possible to hide the private data implementation? Since this member data can basically only be used by member...
asked by 10.06.2015 / 03:06
3
answers

Why does the code print 0 instead of 5?

Why does this code print 0 instead of 5 ? class B { private int b; public int getB() { return b; } public void setB(int b) { b=b; } } class A { public static void main (String[] args) { B b = new B();...
asked by 21.02.2017 / 01:44
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

How do I block access to parameter creation in a class?

import math class Circulo(): def __init__(self): super() self.__raio = None def get_perimetro(self): return 2 * math.pi * self.raio def get_area(self): return math.pi * self.raio ** 2 @property...
asked by 17.07.2017 / 05:40
3
answers

Relationship Has-in C #?

I tried to make a relationship in C # and I'm not getting it and I do not even know if it's recommended to do it. Here is my error code:    System.NullReferenceException Object reference not set to an instance of an object. class Progra...
asked by 06.02.2015 / 00:15
1
answer

What happens in real life in a developer environment if the programmer does not encapsulate an attribute? [duplicate]

The programmer John went there and created a Cliente class and the public double saldo attribute and the Sacar() public method as well. What is the problem with leaving the double saldo attribute, what would be t...
asked by 12.05.2017 / 23:36
2
answers

How to return a pure Json (without XML encapsulation) using webservice in C #

I have a webservice running locally , which performs queries directly in a database using a string parameter . Here is the result of the query: ThesecondtimeIhaveajavascript(Jquery)applicationthatconsumeswebserviceviaAjax.Aftersomeresearch...
asked by 02.11.2016 / 15:08
1
answer

Encapsulation Principles

I am studying for the Java Programmer SE 7 I certification exam. I use SelfTest Kaplan (recommended by Oracle itself). I came across the following question: (I'll leave everything in English on purpose, not to translate and end up omitting...
asked by 27.02.2017 / 17:40