Questions tagged as 'classes'

2
answers

Why can not variables in the same instance be read in different processes? (Python)

I have two processes going on and I have a class containing a method that modifies a value, as you can see in the code below. The ButtonObject function represents a click, to modify a value. But the question is, why does the change only occur wi...
asked by 23.01.2018 / 11:26
3
answers

UML classes associations

I'm from the time of structured programming and now I'm coming back and trying to fit in with OOP. I made a diagram below, could you analyze if I'm on the right track? I created this class Empresa thinking not to be limited in the two...
asked by 04.07.2018 / 20:30
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

Interface vs Class - methods visibility

I've done a job for school and it's working perfectly. In the code I have some private methods. Do I need to create an Interface of this class to hide these private methods or can they be in the same class as the public methods? At this po...
asked by 14.05.2015 / 12:51
1
answer

Is there a way to use a function in the declaration of an attribute in PHP? [duplicate]

Hello. You can do something like this: class Net { public static $ip = getenv("REMOTE_ADDR"); } Get the return of a function and assign it directly to the property? Or create a variable outside the class and assign it to a property...
asked by 03.01.2017 / 17:45
1
answer

How to submit attributes for extended classes?

class Veiculos { protected $tipo = "carro"; } Below I'm trying to identify what type of vehicle the Veiculos class has assigned. I created a tipo_veiculo function that should show the user which type of vehicle he chose and a...
asked by 05.01.2016 / 01:46
1
answer

How can I read the Docblock of a PHP method for a string?

I would like to know how I can read the Docblock of a method in PHP and turn it into a string. For example, I have the following code: class Stack { /** * @return void */ public function overflow() { } } How...
asked by 02.09.2015 / 17:49
1
answer

Why object is not being instantiated?

I have a Bean class ( Casa.java ) public class Casa{ //atribubutos private String parede; public Casa(){ } //getters e setters public void setParede(String parede){ this.parede = parede;...
asked by 15.10.2015 / 17:01
1
answer

Finding the object class in Java

I have a set of functions to configure a set of parameters in Java of type like this: public void Util.setParametros(Integer par) {} public void Util.setParametros(String par) {} public void Util.setParametros(Long par) {} public void Util.set...
asked by 29.06.2015 / 19:13
2
answers

How to put css style with javascript looking for classes

Goal and get invisible text with css visibility: hidden; e effect through javaScript I want to pass a function that when I push a button all classes with visibility: hidden are visible .. did you understand? I have the following...
asked by 11.08.2018 / 20:25