Questions tagged as 'encapsulamento'

0
answers

CompareTo method of the Comparable interface allows encapsulation breaking?

The Student class has its private attributes and to access or modify them requires the use of the get and set methods. In addition, the Student class implements the Comparable interface. class Estudante implements Comparable<Estudante> {...
asked by 11.06.2017 / 21:00
1
answer

Defining a method's chained methods

Let's say I have the following class: class animal{ private $animal; private $som; function gato(){ $this->animal = 'gato'; return $this; } function cachorro(){ $this->animal = 'cachorro';...
asked by 04.07.2018 / 00:57
1
answer

Encapsulation and Get and Set methods

I'm continuing my studies on object-oriented Java programming. I'm currently studying encapsulation and get and set methods and came across the following exercise:    Encapsulate the value attribute of the Ticket class.     ...
asked by 27.03.2016 / 21:01
1
answer

How do I calculate Euclidean distance

I have a class Ponto : public class Ponto { public int x; public int y; public int getX() { return x; } public void setX(int x) { this.x = x; } public int getY() { return y; }...
asked by 11.04.2014 / 16:35