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
-
1
votes1
answer212
viewsJava @Path and @Produces error
Error in the use of @Path in Java. package resource; import java.util.ArrayList; import java.util.List; import java.nio.file.Path; import java.nio.file.Paths; import domain.Album; import…
-
1
votes1
answer275
viewsSort class list in Python
I have a class defined as follows:: class Cromossomo(): def __init__(self, cromossomo, comprimento): #Construtor self.cromossomo = cromossomo self.comprimento = comprimento From it I have a list of…
-
1
votes1
answer5446
viewsPython 3 import of classes
I have three . py files in my directory: Banco.py, app.py, Usuarios.py. My app.py contains the Tkinder import that I am using in the code and here I start all my view and in it I import the class…
-
1
votes1
answer61
viewsFunction within a function
I’m doing some tests and I’d like to understand why when my role somadez() is called is returned to me that function soma() was not defined being that the same when it is called works. Follows the…
-
1
votes1
answer93
viewsHow to interpret the composition connector in a class diagram?
The teacher asked to make a relationship between parents, state and city. From what I understood of this relationship I made this diagram. Only he said that the diamond side is on the wrong side and…
-
1
votes4
answers938
viewsPrivate or protected class in PHP
You can create a private or protected class in PHP to allow access to its variables and functions only to other specific classes? Applying: I have a class where I create a connection with the…
-
1
votes1
answer373
viewsPicking up text within a <ul> PHP list
Hello, I am creating a project I need to get some texts within a list on another site, I will show you how I need; I’m using the file_get_contents; $url = "www.site.com"; $html =…
-
1
votes1
answer508
viewsJAVA POO - How to call a function from a Class
So I have the following problem , I created a 30x60 matrix in which I will generate a number in a random position, so far so good. But when I took the function that generates the number and put it…
-
1
votes1
answer82
viewsClasses with operations extending another class
I have a class called cliente class cliente { private $id; private $nome; function getId() { return $this->id; } function getNome() { return $this->nome; } function setId($id) { $this->id =…
-
1
votes0
answers235
viewsRetrieve value of variables within a Class in a Python function (partial_fit)
I am creating a new algorithm to run along with the algorithms provided by the package sklearn in python, however the dataset used is extremely large and I am using the function partial_fit…
-
1
votes1
answer942
viewsHow to access parent class attributes in PHP?
How do I access the parent class attributes once I instated the child? Direct access $Filho->atributoPai doesn’t work. Access by function $Filho->getterPai doesn’t work. For every inherited…
-
1
votes1
answer350
viewsHow do I call a function in Swift Xcode
Good evening, I have a function that is attached to a button, I would like to call it directly without the need of the button, what I do? The function... static func goToTutorialOrTo(market: Market,…
-
1
votes0
answers38
viewsReceive $POST data to validate login
A little help hehe I’m having trouble creating a login validation in a pattern MVC. I think I managed to structure it right and my login screen appear in the index. So far everything okay. When I…
-
1
votes0
answers20
viewsWhat are the members' initialization lists and under what circumstances should they be used?
What is the purpose of a member initialization list that is used in class/struct constructors in the C++ language and under what circumstances it should be used.
-
1
votes1
answer98
viewsProblems starting methods in a python class?
I’m new to python and started with classes now, tried to start a class but for some reason always gives error, the error changes but always gives, at the moment I am with the code this way : class…
-
1
votes1
answer174
viewsClasses and scope of php variables
You see, my question is more about how to reference and "get" the content of a variable in a PHP Class. See excerpts of the code below, where I put wrong data for the connection, on purpose, to…
-
1
votes2
answers297
viewsQuestion about a C++ function that functions as a destructor?
I understood all the code below but in a certain part the person cites something as destructor? What is it? What is it for? That would be the part here: ~Vetor() { delete [] vet_pos; delete [] vet;…
-
1
votes1
answer463
viewsNameerror: name 'Window' is not defined
I’m following this PDF, I’m on page 10, the code is wrong and I don’t know why. from tkinter import * class Janela: def __init__(self,toplevel): self.fr1 = Frame(toplevel) self.fr1.pack()…
-
1
votes2
answers104
viewsUse/change property of an extended class and print by instance
Example scenario Root folder Classea.php Classeb.php index php. Filing cabinet: classeA.php class ClasseA { public $retorno = null; public $error = "Erro desconhecido"; function __construct { $this…
-
1
votes1
answer260
viewsUpcasting and Downcasting
I know that Upcasting is to convert a subclass object to the superclass and Downcasting is to convert a superclass object to the subclass. But in relation to the loss of values and the like, as it…
-
1
votes1
answer55
viewsTransform level into variable
I would like to create a new column, transforming Tab1612SojaRend$Nível.Territorial the levels "Great Region" and "Federation Unity" in columns. The "Unity of the Federation has to be in the same…
-
1
votes2
answers1025
viewsAccess private attributes of a class within another class
I started studying PHPOO and I’m having difficulty accessing the attributes of the class Pessoa that are private within the class Login, follows the code class person class Pessoa { private $nome;…
-
1
votes1
answer136
viewsCan static classes and methods be used in ASP.NET MVC without problems between user sessions?
I did a routine of login using cookies and as I’m always looking for this information, so you don’t have to be instantiating everywhere I use I left these static classes, my question is if there…
-
1
votes1
answer55
viewsadd blank line to a list
I have a list already with data and I want every 3 lines to add a blank line in this list. To then move to a grid. How can I do that? For now the code is like this: anoanterior =…
-
1
votes1
answer35
viewsDifference between selector.class and . selector class
Hello, everyone. I’m a beginner in programming and I have a question in CSS. In a code where I want all H5 who have the class . special be red, there is some difference between H5.special and .…
-
1
votes1
answer1014
viewsError with php Fatal error class: Uncaught Error: Call to Undefined Function run_search()
I tried to create a class, and getting the error below I already researched more not found why is giving this error. Error: Fatal error: Uncaught Error: Call to undefined function run_search() in…
-
1
votes0
answers63
viewsC++ How to take the string of the get method of a class x and concatenate with a class y string?
I am programming a code in Qt(C++) and I need to take values from the client class in the menu class (which I do not inherit from client) and concatenate into a string to print on the screen.…
-
1
votes1
answer78
viewsHow to iterate inside a list that is inside another class?
I wonder if it is possible to iterate a list that is in another class. On a social network, every user has a list of posts, but this list is defined only in the class User how to iterate inside it ?…
-
1
votes2
answers245
viewsHow to make a Class property of another Class? C#
I am doing a job of the facul that is for control of fleet of vehicles, I created a class Travel and I tried to put the classes Driver and Vehicle in this class. public Motorista {get; set;} public…
-
1
votes0
answers288
viewsHow to take a variable from another class in Kotlin?
I want to take a variable from one activity and use it in another class. This variable will be filled by a user in an editText called editTextSerie override fun searchSeries(listener:…
-
1
votes2
answers511
viewsJava IMC, helps with an error
What’s wrong with that code, I can’t print the IMC calculation? Error is in the last lines of the Person Class. package exe_3_ques_02; //import import java.util.Set; import class…
-
1
votes0
answers60
viewsCreate variable javascript constructors
Lately I’m creating javascript classes defining what I don’t want to be public during the constructor, using Noughtclass.myVariable ex: class NovaClasse { static podeMexer = false constructor(){…
-
1
votes1
answer129
viewsHow to set instance variable using the read value of a Scanner?
To declare the value of a class instance variable Paciente by class Main with the Scanner in Java? Codes: public class Paciente{ private double cod; private String nome; public getNome(){ return…
-
1
votes1
answer246
viewsClasses with private Javascript properties
I’m starting my programming frontend, and started messing with classes in Javascript (following the standards set out in Ecmascript 6). But I’m having trouble using private property and methods. I…
-
1
votes2
answers482
viewsWhen is it recommended to Initialize a final property in the Class constructor?
The example below is a summary of the original (Bringing it all Together) found on the official Flutter page. On the first call, the class Cart is initialized by the constructor and in the second…
-
1
votes1
answer54
viewsDoubt about class Abstract and method __Construct?
I have the following class: abstract class Weeks { protected $year; protected $this_week; protected $last_week; /** * @param $date deverá ser no formato new DateTime(). **/ public function…
-
1
votes1
answer400
viewsI’m having trouble compiling a java code using Packages on linux
I don’t know exactly the command to compile a java file on linux that shares the same package. I tried to follow this tutorial:https://www.webucator.com/how-to/how-compile-packages-java.cfm but the…
-
1
votes2
answers514
viewsPass class object as constructor parameter in C++
Good afternoon, you guys! I’m studying for a C++ test I’m doing this week, and I’m having a hard time passing an object as a constructor parameter. Could you explain to me the right way to do it? I…
-
1
votes1
answer131
viewsHow to write a python module from a test?
I’m doing an inverse exercise on Python modules and tests with pytest, but I’m not succeeding. Whenever I run the code I get the message "E Attributeerror: 'str' Object has no attribute…
-
1
votes2
answers85
viewsHow to create a property in a Javascript method
Good evening everyone, I am a beginner in Javascript, and I have a question regarding the properties. How can I create a property in a method in Javascript? I mean the methods because I’m learning…
-
1
votes1
answer91
viewsReturn an instance of the same class in Static Function
I’m trying to return an instance of the same class in static functions, for example, in the code below, works normal: class Router { private $name; public function get() { return $this; } public…
-
1
votes2
answers109
viewsAccess a Form method to another Form
I have a Method carregarLista() on form calling Funcionarios, and would like to access this method from another Form called Cancelar. The method is published in Form Funcionarios, I just can’t…
-
1
votes1
answer58
viewsProblems instantiating objects in python
I’m new to programming, but I just came from Java and I’m migrating to Python.. To start I created a simple Person class with 3 attributes and tried to instantiate it to see the syntax, but I just…
-
1
votes1
answer53
viewsHow to access mother class fields through inheritance?
Simplifying what I mean, suppose I have a Mother class: public class Mãe { private String nome; // Declarando o campo privado nome public Mãe(String _nome) { nome = _nome; // Definindo o campo nome…
-
1
votes1
answer59
viewsCS0747 Error with C#declared
I have created a list that receives my command object powered by the fields of my Forms, my class: public class Comanda //Essa classe carrega tudo necessário para o pedido. { public int idComanda {…
-
1
votes1
answer71
viewsAdd object validating if it exists
I am creating these two methods in which the first worth the existence of a vehicle from your name. In the second, it is intended to add a new vehicle, validating first, if there is a vehicle with a…
-
1
votes1
answer58
viewsProblems tried to change function next()
I need to do this class-related activity, I don’t know much about it yet and I’m a little confused. Write a Python class with a custom iterator, when the next() function is called, it should return…
-
1
votes1
answer37
viewsHow to declare a class and how to define its values?
I’m trying to make a Pokemon simulator similar to Pokémon Showdown, but I’m doing it from scratch. In addition to having the functions of a common Pokemón game, you’ll have some customized. I would…
-
1
votes2
answers234
viewsError "Maximum recursion Depth exceeded" when implementing Setter
I’m learning python and wrote the following code: class Produto: def __init__(self, nome, preco): self.nome = nome self.preco = preco def desconto(self, percentual): self.preco = self.preco -…
-
1
votes0
answers24
viewsPython - module 'Cdt' has no attribute 'CDT'
Hello, I am working with a code that uses two classes in two files: Radoncdt and CDT. The first one needs the second one. However, when trying to use one of the functions of the CDT class, I get the…