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
answer179
viewsHow does class inheritance work in C#?
I have class 1 and class 2, class 2 inherits from class 1. Other classes that inherit from class 2 will inherit the attributes of class 1?
-
1
votes1
answer297
views -
1
votes1
answer1041
viewsHow to represent an N:N relationship in java?
I think it’s a very simple question, but I couldn’t find any example that would make that clear. I already made my database model in Postgresql and when it came to creating the classes I was a…
-
1
votes1
answer185
viewsClass declaration in C#
What other access levels can I declare a class in C# besides public and private. I found these levels in the microsoft website: protected internal protected internal…
-
1
votes1
answer81
viewsConcurrent.Utures and Class Object
I am trying to create a class (Processor) that runs a series of functions to get results from a State-to-State API. (STATE) 1- READ data from a table. 2-SEND request for the API to process. 3- WAIT…
-
1
votes0
answers569
viewsWhy use gets and sets in classes?
What is the reason and when to actually use gets and sets instead of a publish variable in classes? They say it is a bad practice to use and modify a variable as public, why? Example 1: class Teste…
-
1
votes1
answer439
viewsI calculate to buy fuel by value?
I am doing a program of a fuel pump using classes, but I am not able to calculate the amount of fuel for the value inserted, someone can give a light? class BombaCombustivel(): def __init__(sel,…
-
1
votes1
answer182
viewsOverwrite static method
I don’t even know how to ask the question, but I’ll try. I have a static method in a parent class, and I planned to overwrite in the child classes, but from what I’m seeing here, this is not…
-
1
votes1
answer658
viewserror: field has incomplete type
I get this mistake error: field has incomplete type by doing something like: class MinhaClasse { MinhaClasse teste; // Erro aqui }; I already tried to add this line at the beginning of the code…
-
1
votes1
answer116
viewsChange Class according to ID
I have the following structure. <div id="cabecalho"> <span data-bind="attr: { id: solicitacao.numero}"></span> <div> where, request returns me a number from 1 to 10 i would…
-
1
votes2
answers248
viewsCall method by class or by instance?
What would be the most correct way to call a method of another class? It is more correct to create the object: private MinhaClasse minhaclasse; minhaclasse = new MinhaClasse(); To then call a…
-
1
votes1
answer87
viewsHow to declare list in class?
I have a class Usuario you will have a list of the class Pastas, and this class will have a list of the class Questão. public class Usuario{ String nome; ArrayList< Pasta > listaPasta; } My…
-
1
votes0
answers514
viewsObject Orientation in PHP, crud example with ajax
I’m trying to learn Object-Oriented PHP, but I’m having a hard time finding an example. Someone can show a simple example of the crud case below: A php class, for example user, in this class has…
-
1
votes1
answer111
viewsProblems Converting Session to Class in C#
I have the following variable List<MyFile> xmlDisponivel = new List<MyFile>(); This variable is a list of the following class public class MyFile { public string FileName { get; set; }…
-
1
votes1
answer227
viewsHow to call Finish() a separate class?
I have an application where when the user clicks "Back" on MainActivity he displays a AlertDialogin the method onBackPressed() asking if you really want to quit the app. But I created a new class…
-
1
votes0
answers25
viewsReflections with Kotlin
I need to compare a Kparameter with a Kclass, know if the type of the parameter is equivalent to my Kclass. So far I have not found a saint to do this, someone has my solution?
-
1
votes3
answers450
viewsAccess modifier protected
A common class (which is not subclass) and has no inheritance, can use an attribute protected of a superclass that has a subclass? If so, this attribute will be visible (no need to use the…
-
1
votes2
answers283
views -
1
votes0
answers802
viewsError Class not found with Composer
Good people, next, I’m doing a project here and giving me some problems, I think I’m mixing things up. I installed Composer to use autoload and other dependencies, but now I have a problem: The…
-
1
votes2
answers730
viewsClass with method to change a parameter
I have a User class with private attributes like Nome, Endereco and Telefone. This class has a constructor method that takes parameters such as nome, endereco and telefone. I would like to use a…
-
1
votes1
answer148
viewsHow to duplicate visualization of HTML elements
I have 5 images, and 3 of them have the same class being exhibited on div To. <div id='A'> <img src="https://sites.google.com/site/mplayerplugin/thumbnails/09.jpg" class="figura" />…
-
1
votes0
answers24
views -
1
votes1
answer643
viewsI can’t get functions from the System.Management class
I am unable to call some functions of the System.Management class; for my program. I’ve tried to put using System.Management; or System.Management.ManagementObject but it also doesn’t work. Code:…
-
1
votes0
answers327
viewsSlim Class Controller not found
I’m trying to make a model in MVC here, using some controllers. Follow my directories: Root/ app/ Controller/ Padrao.php public/ index php. Composer.json My file index php. (Yes, leaving td mixed,…
-
1
votes2
answers220
viewsHow to pass an attribute of the child class through the constructor to the mother class
I have 3 classes Mother class: Animal Child Classes: Dog and Cat I want to save the name attribute only when one of the objects is instantiated Gato or Cachorro. In the mother class I have the…
-
1
votes1
answer129
viewsError: expected class-name before
I’m developing a project where I have an online class that inherits from an X class, where this X class needs to give a new on an online class object. When I do this error happens due to inheritance…
-
1
votes3
answers73
viewsHow to create a class with type inference that can have a default type in C#
I’m creating a class where I make type inference, as in the example below: public class Foo<T> { public T Bar { get; set; } } Is there any way I can set T to a default type like string? My…
-
1
votes0
answers13468
viewsHow to represent a class diagram between Manager and employee
Hello, everyone I have a Food Truck system and need to know mainly the relationship of the manager and employee... Is my diagram correct? The module 1 mainly. • Specification: Manager module I.…
-
1
votes0
answers151
viewsHow to resolve Fat Jar Export: Could not find class-path entry
I’m having serious problems exporting a program made in Eclipse and I’m starting to hate myself for trying to be organized. I imported two third-party libraries (Javamail and iText 5) into my…
-
1
votes1
answer131
viewsHow to implement the Parcelable class?
I need help when it comes to object orientation. I need to implement the class Parcelable in the model Produto, but for the sake of organization, I would not like to implement directly in the class…
-
1
votes1
answer487
viewsGet and Set using PROPERTY - Python3
As an apprenticeship of Property, created a small currency converter. See: class converteMoeda(): def __init__(self, dollar=0, real=0): self.dollar = dollar self.real = real def toDollar(self):…
-
1
votes1
answer64
viewsSwitching screens with the same XML file
I am developing an educational application (with various exercises about java and explanations) for Android, but I have a question: the application becomes very heavy if I create a Activity (with an…
-
1
votes1
answer252
viewsDoubt about Python classes and methods
I have a question, I can’t do an exercise in classes and methods. 2 - Create the class "Date" with the attributes: day, month, and year. And create the methods "setarData(receives day, month and…
-
1
votes1
answer213
viewsHow many classes can I put in one code?
How many "classes" I can add to my code? Let’s say I have the following existing command block: namespace _06_ByteBank { public class Cliente { private string _cpf; public string Nome { get; set; }…
-
1
votes1
answer55
viewsFunction per parameter does not modify variables
I built a binary tree class in which I have a function bfs that goes all the way through it. As a parameter this method receives a function pointer void (*Op) (node_BT <type> *) that will be…
-
1
votes1
answer39
viewsJavascript- Syntax of classes
class Greeter { constructor(message) { this.greeting = message; /* this.greet = () => { return "Hello, " + this.greeting; --> Método dentro do construtor */ } greet() { return "Hello, " +…
-
1
votes1
answer31
viewsPq shows this strange result when printing the values defined in class ? (Python)
Guys, I created this class (Car class), then defined the values for each argument of this class. Only when printing the variable with the values already defined, this appears: #isso é o que aparece…
-
1
votes4
answers106
viewsWhat’s wrong with my class function to diminish the value?
I’m developing a class to better manage my items in a more organized way. When the value of the variable is less than the minimum value was to go to the maximum value, however, in practice this is…
-
1
votes2
answers80
views -
1
votes2
answers61
viewsStatic class system settings in the Entity Framework
I am trying to create settings for a system. I thought of a class similar to the example: Class: public static class Configuracoes { [DisplayName("Casas Decimais")] [Description("Informa o número de…
-
1
votes2
answers1254
viewsrequire_once does not work
I’m trying to give require_once in a PHP file that has a class. The File I’m trying to include in PHP with the class has only one array with configuration data, but I can’t access it properly. class…
-
1
votes2
answers489
viewsWhat are the differences between Value Objects and entities in object orientation?
I would like to know the differences between the concepts of Value Objects and entities in object orientation. NOTE: The question is not whether the use of these concepts are good or not, the doubt…
-
1
votes1
answer147
viewsHow to call class method within the thread?
How do I call a class method inside a thread? I have a very simple thread and a class method. How do I call it inside the thread. As it is in the code below the compiler gives error #include…
-
1
votes2
answers127
viewsUse of the "Instance of"
public class AlunoLicenciatura extends Aluno{ private String curso; private ArrayList<Disciplina> l_dis; public AlunoLicenciatura(String curso,Aluno a){…
-
1
votes1
answer1300
viewsExchange of information between Python classes
How can I exchange information between two different classes? I need to pass data from one to the other. Each class is running in a different process. An example of the structure, the code is too…
-
1
votes2
answers41
viewsReturn Updated Android Date Time
I made a class called Current Date containing this data: package com.projeto.projetov1.model; import java.text.SimpleDateFormat; public class DataHoraAtual { long date = System.currentTimeMillis();…
-
1
votes1
answer61
viewsNon-existent C++ class pointers, how does it work?
Sometimes I find myself in situations like this: #ifndef CRIARVENDA_H #define CRIARVENDA_H #include <QDialog> #include "cliente.h" namespace Ui { class CriarVenda; } class CriarVenda : public…
-
1
votes1
answer288
viewsI have a question about inherited default builders
I am doubtful when trying to improve a POO exercise here.. (-) = without I have the PAI class with two constructors (one is default). In the FILHO class I have two more constructors (no-default). In…
-
1
votes2
answers97
viewsHow to assign a class to the whole and not just attributes separately?
I have a class constructor method that when called makes a query in another database class that returns me the same constructor method class(only with the assigned data), example: public Invoice(int…
-
1
votes1
answer406
viewsWhat is a Service Class? And what would a Service be in that context?
What would be the best formal definition for Class of Service? Still in this context, what would be a Service and the conditions for this class to be named? I realized that is a term widely used but…