Most voted "classes" questions
In object orientation, a class is a structure that abstracts a set of objects with similar characteristics. A class defines the behavior of its objects through methods and possible states of these objects through attributes. In other words, a class describes the services provided by its objects and what information they can store.
Learn more…715 questions
Sort by count of
-
0
votes1
answer42
viewsWhen and where to instantiate a class?
When performing the project, it is recommended to instantiate a Class in the file where it is implemented (Ex.: "classname.Class.php"), causing it to be instantiated even without being used in the…
-
0
votes0
answers31
viewsJavascript with Class function
Good, I have the following code that runs a sequence of images: var setInter = null function startAnimation() { var frames = document.getElementById("animation").children; var frameCount =…
-
0
votes1
answer282
viewserror creating matrix with variables in c++
When I declare matrices in c++ within a class, defining "rows' and "columns" of that matrix by integer numbers directly with arguments, example [2][5] I can have the correct functioning. However…
-
0
votes1
answer74
viewsHow to read a file that is inside an EAR
I have the following structure of an Ear application myApplication.Air /META-INF/file.properties War/WEB-INF/lib/myLib.jar/myClasse.java file I would like to retrieve the file from my Classe.java.…
-
0
votes1
answer43
viewsTransactions between several classes
Good, I’m relatively new to Java programming! The following is a Super Class named User of which there are 2 subclasses Citizen and Autarchy, within the Citizen class I have created an Arraylist…
-
0
votes0
answers360
viewsCall a method of a class from a function within the class itself? C++
I created the "checkCase4" function in my Tree class and within it I make 2 class methods (rotate_left and rotate_right). Function: void checkCase4(Node *child, Node *grand) { if (child ==…
-
0
votes2
answers331
viewsphp mysqli last record
I have a page that makes connection through the mode mysqli class below: # include da classe class connectionClass extends mysqli{ public…
-
0
votes0
answers238
viewsCalling a method in another Android class
Good morning gentlemen, I’m with a doubt, I’m trying to call a method that is in another class but is not working, this same method already works if using another layout, just wanted to implement it…
-
0
votes2
answers202
viewsParameters in JOB Laravel class 5.8
Error passing variable as parameter in constructor of an Laravel job Too few arguments to function App\Jobs\ImportDocumentJob::__construct (), 0 passed in…
-
0
votes1
answer1135
viewsC#, what are methods, classes, and objects?
What are the differences between the three? Do they have any other differences? I’m new to development, and I want to learn more.
-
0
votes1
answer1059
viewsCreate separate method to call Activity
i created a script where I intend to call separate activities but it’s not working package com.example.john.new_login; import android.content.Context; import android.content.Intent; import…
-
0
votes1
answer286
viewsNamespace does not work in php 5.5
I’m making a simple system using php with mvc structure and I want to use the namespace, however, of the error stating that it does not find the Data class. Error: Fatal error: Class 'Config…
-
0
votes1
answer48
viewsHandling object only in methods
When I create an instance of a class I can access its attributes only when I’m inside a method, why? In the example below I can give a set in the method main() but not within the class, why? public…
-
0
votes2
answers324
viewsHow to access parameters received from a class in an external javascript function?
How can I access parameters received from a class outside its scope, as in the function below. Or is there another better way to do this? helper.js class Helper { constructor(user) { this.user =…
-
0
votes1
answer72
viewsCalling one class within another
I am using classes within classes and wanted to know if I can instantiate the second class in the constructor of the first. It works and I didn’t notice any problems related to performance, but I…
-
0
votes2
answers466
viewsIs it wrong to mix struct with class in C++?
I have the following class: #ifndef PESSOA_H_INCLUDED #define PESSOA_H_INCLUDED #include <string> struct aniver{ int dia; int mes; int ano; }; class Pessoa{ private: std::string nome;…
-
0
votes0
answers559
viewsInstantiate class on application start
I would like to know if it is possible to instantiate a class and use it throughout my application without having to instantiate it and import it. I have my app.: import { Component, OnInit } from…
-
0
votes0
answers62
viewsWhat is it and how can I use extends and Abstract in a public main?
Hi, I’m a beginner in programming and am currently learning in the game development course. The course teacher couldn’t make it clear to me what it is and how to use extends and Abstract, I watched…
-
0
votes1
answer71
viewsPdfsplitmerge class not registered in Delphi XE
I have a system that uses Unit Pdfsplitmerge_tlb, happens that compiles in a good, but when executing and trying to use the Object Tcpdfsplitmergeobj he says the class is not registered Example of…
-
0
votes1
answer82
viewsI didn’t understand how the (self) value works in "city.state = self " within the add_city() function
class Estado: def __init__(self, nome, sigla): self.nome = nome self.sigla = sigla self.cidades = [] def adiciona_cidade(self, cidade): #essa linha abaixo que eu não entendi o que significa…
-
0
votes2
answers333
viewsWhat is and what is an override (method override) for in programming?
The title of the question basically says it all: what is and what is a Override (method envelope) in the programming?
-
0
votes2
answers65
viewsWhy can’t variables from 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 Eventoboton function represents a click to modify a value. But the…
-
0
votes1
answer526
viewsChange an attribute of a base class by the derived class C++
I’m having a problem involving inheritance in C++, I can’t change an attribute of a base class ex: // classe base class Base { vector(string) Names; //coloquei entre parenteses porque por algum…
-
0
votes1
answer80
viewsClasses do not load! Script runs on xampp but does not run on LAMP/LEMP/VPS
Guys, I made a very light and simple script. In xampp it runs normal, but when I go up to any server does not go at all. I’ve tried the Lamp, Lemp (From Digital Ocean), at VPS (Dreamhost), but it…
-
0
votes1
answer53
viewsgetter-Setter error #python
I wonder where is the error in this supposedly simple code class Nome: def __init__(self,nome,sobrenome): self.__nome = nome # variável privada self.__sobrenome = sobrenome # variável privada…
-
0
votes1
answer134
viewsClass error in Python
I created the code below but it’s giving me error: Pessoa = Empregados('joao') TypeError: Empregados() takes no arguments. What I might have done wrong? class Empregados: def __int__(self, nome,…
-
0
votes1
answer34
viewsI can’t run a class
So guys, I’m trying to run an app to upload an image to my server. Without saving this data to the database, the upload usually occurs, but when trying to include the image link in the database, php…
-
0
votes1
answer48
viewsTransform getElementsByClassName into elementRef
I made a code and would like to transform my getElementsByClassName and elementRef, below show how I did and how I tried to adjust tabContent = this.tabContent.nativeElement.innerHTML; for (i = 0; i…
-
0
votes1
answer40
views"super" and private variables
In the case below, it makes sense to call super() in class B_Class since the variable a of A_Class is private? It would be more feasible not to use the parent-class builder? Compiling this code…
-
0
votes2
answers4327
views -
0
votes1
answer85
viewsList Classes with Generated Jar
I have a class that searches and lists the classes within my jar, being it: public static Class[] getClasses(String packageName) throws ClassNotFoundException, IOException { ClassLoader classLoader…
-
0
votes1
answer31
viewsAdd class according to text by JS / Jquery
I am styling radio-button and need to add class according to the text of the button. Actually it is very simple and works with the code below, I need that instead of inserting the data-title="" be…
-
0
votes0
answers10
viewsWhat can determine whether a class relationship is strong or weak?
In this case, I am using c# and learning POO, so I would like to know the answer to this question: What can determine whether a class relationship is strong or weak?
-
0
votes0
answers102
viewsonActivityResult in another class
I am creating an app where I have several camera calls, and I would like to create a class to call the camera to use in the project , well, the call from Activity is being made with the…
-
0
votes0
answers125
viewsC/C++ How to declare a type for event handler in a class?
I need help in C/C++ to know how to define a type for event handler that will be used as a class member. This is an example that works with simple variables and functions: #include "cstdlib"…
-
0
votes1
answer107
viewsWhy does the class accept parameter and the method does not?
I’m studying classes in Python and I don’t understand one thing: considering the last two command lines below, why the value 4 is accepted in the class Operators and not in the method metade()? Do…
-
0
votes1
answer84
viewsWhy is the text label not changed?
I have a screen class, which contains a label of text, the code loads an xml containing the objects. py screen.: #!/usr/bin/python3 import gi import modulo_arquivos import os…
-
0
votes1
answer31
viewsUnknownnode when loading XML in class
I get the following XML from a database (modified data, but the structure is this same) <registro> <header> <codUsuario>XXX</codUsuario>…
-
0
votes0
answers68
viewsCalling class that generates JSON
Good morning! I am breaking my head to recover the Class that generates JSON, I have the following class name apiBusca.php public function enviarRequisicao() { $url = 'API'; $json = new StdClass();…
-
0
votes2
answers46
viewsImplementation of member functions
It was overloading operators and defining them within the class itself, I found it natural to do so for these functions, but then a small doubt arose. Is it wrong to define member functions within…
-
0
votes0
answers76
viewsC++ - How to pass a string to a class
I have a little problem when I try to pass a string to a class. In short: in the main program I will read this string and move to the class: cout << "----- Vamos as opcoes! -----" <<…
-
0
votes0
answers31
viewsError creating tables - ASPNET-CORE-C#
Good afternoon to you all. I am studying C# with Asp Net Core and I am having problems in a matter of a job. I need to create several tables (consultation, doctor, patient...) within the…
-
0
votes0
answers12
viewsWhat does __class__mean?
I was reading a code in Python when I came across this excerpt: def __init__(self, conexao): __class__.conexao = conexao __class__.centro_espacial = conexao.space_center self.iniciar_decolagem()…
-
0
votes0
answers43
viewsI have a simple class and it doesn’t answer when I call the methods
Can someone help me? class sorvete(): def __init__(self,sabor, recipiente): self.sabor= sabor self.recipiente= recipiente self.ml= 0 def sabor(self): print("O sabor que pediu é: ", (self.sabor)) def…
-
0
votes1
answer30
viewsHow to run a class code in Android Studio when you don’t have an Activity?
I’m trying to learn Kotlin, but I want to test certain algorithms and I can’t run a class because Android Studio can’t find Main Default. Doesn’t have a way to run a class at the Android Studio…
-
0
votes0
answers99
viewsHow to use a Friend function within a class
My program is structured as follows : Classe.cpp // Implementation of class methods Classe.hpp // Prototypes of the class Main.cpp // Main file In my file Classe.hpp I have the prototype a function…
-
0
votes1
answer34
viewsUse variables to define an object or not?
Recently watching some tutorials, I see programmers omitting the variables in code block. I don’t know what this practice is called, but I wonder if it is recommended, what are the advantages and…
-
0
votes0
answers19
viewsHow does the self parameter work in the class?
How self works in class? class Cachorro: def comer(self): print('Cachorro está comendo.') dog = Cachorro() dog.comer()
-
0
votes3
answers87
viewsIn the Kotlin language, how to access a public variable that is in one class, through another class?
WHAT I DID: I created a class in android studio and I did it using Kotlin, and within this class I created a "public" variable like string, asseguir: var variavel_de_tipo_public_string : String =…
-
0
votes1
answer61
viewsHow to reuse class values?
I have three classes, the third one depends on the values of the other two (it depends on the E class Material and of A, Ix, Iu and Iz class Geometria. How can I do this? I know I need to correct…