Questions tagged as 'construtor'

1
answer

How to call asynchronous method in class constructor?

How do I call a method marked as async in a class constructor?     
asked by 22.10.2017 / 14:01
1
answer

In an activity, first open method onCreate or class constructor?

In a scenario where you have an activity with a constructor (public, of course) and the onCreate method which is part of its lifecycle. Which of the two will run first?     
asked by 08.09.2016 / 18:45
1
answer

What does the class name in super () .__ init __ () mean?

What is the function of the name of the classes inserted inside the parentheses of the constructor __init__( ) , in classes Telefones , TiposTelefone and Agenda ?    This is just a code snippet from Chapter 10 of "Int...
asked by 26.07.2018 / 21:59
1
answer

Error in class constructor in React

I get the following error when I try to use the component this way. client?cd17:119 ./src/App/Components/AddNote.js Module build failed: SyntaxError: super() outside of class constructor (9:4) 7 | const FormText = React.createClass(...
asked by 30.03.2017 / 15:17
1
answer

How to call constructors with arguments?

How to set constructor values in the main class by Scanner in a constructor like this?. public Aluno(String nome,int idade) { this.nome = nome; this.idade = idade; } and in the main class call: Aluno pedro = new aluno(); and in...
asked by 29.01.2016 / 20:10
0
answers

Call to a member function cadastrarDados () on null - Laravel

Good morning everyone, I'm developing an application in Laravel 5.6 using PHP 7.2, I'm having problems using the dependency injection in the constructor, since when creating the object the algorithm works perfectly, This DOES NOT work: C...
asked by 06.11.2018 / 11:52
2
answers

What is the purpose of a static constructor?

I've always used constructors as follows: public MinhaClasse() { //Algo ... } However, I discovered that in C # it is possible to create a static constructor as follows: public class MinhaClasse { public string Propriedade { get;...
asked by 03.07.2016 / 23:39
2
answers

How does constructor inheritance work in Java?

In Java when one class inherits from another it is necessary to initialize the constructor of the parent class, right? using super() and passing to this super() the parameters that the parent constructor asks for. Parent class e...
asked by 02.01.2015 / 21:50
1
answer

"undefined reference" in the constructor of a C ++ function

I am creating a class of name VS1838B that is composed of other instances. This is the class header: #ifndef INFRAREDRECEIVERVS1838B_H #define INFRAREDRECEIVERVS1838B_H #include "Arduino.h" #include "IRremote.h" #include "IRremoteInt.h" c...
asked by 28.07.2015 / 05:37
2
answers

How to pass an attribute of the child class through the constructor to the parent class

I have 3 classes Mother class: Animal Daughter Classes: Dog and Cat I want to write the name attribute only when one of the objects is instantiated Gato or Cachorro . In the parent class I have the Name attribute that ca...
asked by 28.09.2018 / 19:58