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
answer58
viewsWhat is the criterion of Java in having in some cases, a class in its API and in other cases an interface?
The Java API is immense, but some pre-defined features in it are implemented through a class and other functionality through an interface. What criterion used by Java to choose one or the other?…
-
0
votes1
answer479
viewsParking class in Python
I’m learning to code in Python. Right now I need to implement a class that has the following features: A class called parking, which simulates the operation of a car park. -The class receives an…
-
0
votes1
answer20
viewsToggle class in Vuejs
I have 3 div with the class ('option') and I have a class as the name of ('Selected'). I would like to remove the class from the div that is already with ('Selected') and switch to the other with…
-
0
votes0
answers14
viewsHow can we draw numbers on two Cells in Javascript and the numbers cannot be equal?
I’m like a doubt. I created two cells in html with a button and did Math.Random to draw numbers from 1 to 10 in these two cells, only I don’t want equal numbers to appear, there can never be equal…
-
0
votes2
answers1874
viewsProblem importing a class from another folder and using it. (Python)
I’m going crazy here. I’m facing a problem that should have been solved by logic already. The problem is this: I have two folders: Novapasta/ Novafolder/classes In the first folder there is a file:…
-
0
votes1
answer1157
viewsHow to Instantiate a PHP Class
Usually to instantiate and use a class in my project, I use: include ('arquivo_que_contem_a_classe.php'); $obj = new obj(); $obj->nomedafunction(); But today I needed a ready-made class…
-
0
votes2
answers217
viewsUse of chained static functions
I wanted to use static PHP functions as follows: class A { static function a1() { echo "A1"; return A; } static function a2() { echo "A2"; return A; } } A::a1()::a2(); Works, but shows this error:…
-
0
votes2
answers51
viewsHow to style css with javascript searching for classes
Aim and grab invisible text with css effect visibility: hidden; and through Avascript I want to pass a function that when I press a button all classes with visibility: hidden be visible. I…
-
0
votes1
answer100
viewsDoubt about Python methods and classes
I have the Login class and created an instance of it in the Main class, with the instance I am calling the start method, but in the start method when clicking the 'Log in' button the…
-
0
votes0
answers203
viewsHow do I use to call another namespace without using include?
I see programmers all the time using the "use" command below the "namespace" command without first using a include. An example is the Medoo library: namespace Medoo; use PDO; use Exception; use…
-
0
votes0
answers28
viewsHelp with object creation
How I put the method descontoINSS on that page? <?php include_once("Pessoa-class.php"); include_once("PessoaFisica-class.php"); include_once("Funcionario-class.php"); include_once("index.php");…
-
0
votes0
answers86
viewsWhat is the difference between self and __CLASS__?
Studying the Singleton design pattern, I was running some tests: class Test { public static $var = "XYZ"; static function class() { return __CLASS__; } static function self() { return self::$var; }…
-
0
votes1
answer37
viewsConvert dictionaries to class
I have a dictionary that contains the name of the activities and some characteristics of this activity. I created a class called process and I want to iterate in my dictionary creating the…
-
0
votes1
answer942
viewsRelation Between Classes in Python
Imagine that you are developing a system for controlling a Vehicles. With this it is necessary to register the vehicles available at the dealership for sale. a) Think about the necessary data and…
-
0
votes1
answer204
viewsUse of Class in Kivy
Good afternoon, I want to make a program that uses several combobox and in one window. But I can’t get both. When I run the program, only one of the combobox appears. Below I send the current code.…
-
0
votes0
answers34
viewsPoint in Model Class attribute is possible?
This is an xml request schema for a Webmethod: <RetrieveClienteRequest> <model query=""> <keys query="" > <cliente.cnpj type="String"></cliente.cnpj> </keys>…
-
0
votes1
answer259
viewssyntax error, Unexpected 'global' (T_GLOBAL), expecting Function (T_FUNCTION) or const (T_CONST)
I’m trying to call a variable into a function, but I’m making this mistake : ( ! ) Parse error: syntax error, Unexpected 'global' (T_GLOBAL), expecting Function (T_FUNCTION) or const (T_CONST)…
-
0
votes3
answers42
viewsHow to simplify these two methods?
Well, in my class there are two magical methods, add and sub: def __add__(self, other): if other.__m == self.__m and other.__n == self.__n: result = [] for i in range(other.__m): lst = [] for j in…
-
0
votes3
answers1359
viewsHow to resolve ERROR: HHH000346: Error During Managed flush [org.hibernate.Exception.Sqlgrammarexception: could not execute statement]
When I try to run my test class I get this error below. I don’t know what else to do, when I comment on the attribute FOLDERAUTOUPDATE class ApplicationItv the insertion in the bank works, but I…
-
0
votes1
answer172
viewsHow to split the addressing of a class into PHP?
What is the best way to divide this Aluno? <?php class Aluno{ private $nome; private $sobrenome; private $email; private $telefone; private $cep; private $rua; private $endereco; private $numero;…
-
0
votes1
answer2108
viewsNotice: A non well Formed Numeric value encountered
I created a fictitious example of a discount on a person’s salary, the code works, but two appear notices I listed below the code: class Descontos{ public $salario; public $inss; public…
-
0
votes2
answers573
viewsDoubt how to send calling a method in another class
I have a cl_Calculo class that has a method that calls a table in sql by a CRUD class already created, and I want in a Form when clicking a button to call the method of this class passing the sql…
-
0
votes1
answer127
viewsI cannot create new class in the project - Visual Studio
I have a project where I created a new class using System; using Definitions; namespace CommunicationCheck{ public class CommunicationCheck { private message_struct Send; private message_struct…
-
0
votes1
answer64
viewsMainactivity recognizes methods from external classes
And everyone, I’m starting to program with Android Studio, but I have a problem. I created a class in the same mainactivity package, and I was able to instill that class, but I can’t use its…
-
0
votes1
answer382
viewserror: expected Primary-Expression before = - Error during object creation:
NOTE: My teacher is teaching modularization in c++, so the files are all divided. I am trying to implement point2d class, but when I try to compile the file by linux terminal, these errors occur:…
-
0
votes1
answer32
viewsHow to know which link class to select with php
I’m creating a website that has information from multiple vendors accessed by an administrator. To display vendor data, I have their names in a table by selecting them from a Mysql database. Taking…
-
0
votes0
answers125
viewsphp call html with class
.up{ color: #80006F; } .up:hover{ color: #CC00B1; } input{ margin-top:20px ; margin-left:0px ; margin-right:5px ; margin-bottom:10px ; } .modal-header{ background: ; } @font-face { font-family:…
-
0
votes1
answer76
viewsHow does a car class in Java convert to C++?
public class Carro { private String nome; private int ano; private String modelo; private String marca; private String combustivel; private Double valor; public String getNome() { return nome; }…
-
0
votes1
answer70
viewsHow to return an attribute from a class based on the minimum and maximum of other attributes of the array?
Hello, I would like to know how I can go through the vector of objects and return the name of the company that has the smallest amount of employees and the name of the company that has the largest…
-
0
votes1
answer523
viewsexport default class and import not working
I am trying to perform the default export of a class in Node.js, but when I try to compile the main.js file a type error is returned: Syntaxerror: Unexpected Identifier at new Script (vm.js:84:7)…
-
0
votes1
answer86
viewsHow to return a query column within a class
I’m updating my entire project to object-oriented PDO, but I’m having some difficulty returning a fetch column in the class query User. After several attempts, so was my code: user php. Class User {…
-
0
votes1
answer153
viewsJavascript - How do I pass a json object in my class constructor?
Good afternoon, I have a question regarding parameters where you pass an object, for example in mongoose has a method connect which we passed to url connection + a objeto to define the options, and…
-
0
votes1
answer183
viewsInsert using methods and classes in the C#database
Hello, good afternoon, sir! My problem is the following: I am wanting to run an Insert event, which in the database will add the (name, user, sector, position, shift and extension), but now I am…
-
0
votes1
answer111
viewsAccess menu mouseover by VBA
I need your help! I am developing a VBA application to extract files from an internal system of the company, where after logged in to the site, the displayed screen has a menubar for access to…
-
0
votes1
answer44
viewsCSS of different Ids for the same Classes
How can I apply the same attributes and the same classes but with different product ids? The following code is working but I think we can simplify this CSS .postid-2201 .product .summary .cart…
-
0
votes1
answer45
viewsConstruction and Class Abstraction
I am developing a small project that takes care of organizing and controlling the daily sales of a retail seller. Basically the user will impute their sales and kpi’s and the application will try to…
-
0
votes0
answers15
viewsRestrict type of argument from a Python method
I need to define a class in Python, which will receive a series of parameters. I would like to make the methods receive arguments of a certain type. An example of the code: class Teste(): def…
-
0
votes2
answers174
viewsHow to create class correctly with pandas by applying methods?
I have a 'data.csv' file, with the data below: turma,nome,code,motivo,atividade,trofeus,data 9º Ano Fundamental A,Maria Joana,9X4YK,Realizar atividade Astromaker,Lição A,3,21/02/2020 11:44:11 9º Ano…
-
0
votes2
answers736
viewsError: non-static variable this cannot be referenced from a Static context
This code is giving error: non-static variable this cannot be referenced from a Static context When I take the static main does not look like the warnings in Netbeans, but when compiling it makes an…
-
0
votes2
answers40
viewsRelate a user input to a class pointer
I would like to relate the class pointer corresponding to the user input and present on the screen the attributes related to that object. #include <iostream> #include "classes.h" using…
-
0
votes1
answer268
viewsInserting in a python sqlite3 database by a class
I am doing a mini project of a registration in a database sqlite3 by python, my problem is that in my method, which registers the product with (id, name, purchase price, sale price, quantity), gives…
-
0
votes1
answer50
viewsDoubt with exercise of Ecmascript 6
This Ecmascript exercise talks about the creation of two classes, one of user (where the email and password will be entered), the other of administrator (where in addition to the email and password…
-
0
votes1
answer155
viewsChange a Component Class React to a hook useState React-Native
I want to transform this code of class in a code of useState hook, wanted the same functionality as this code class has become the Hook export default class App extends Component {…
-
0
votes0
answers29
viewsinvalid types 'double[int]' for subscript array
I have to do a Florentzproton function that takes two vectors and multiplies them using another Productovetorial function (which is in another class), then multiplies the resulting vector by a…
-
0
votes1
answer88
views"Expected Primary-Expression before 'float'", calling a function from another class
I need to create a Florentzproton function in the Physics class that takes two vectors (v and B) and multiply them using another Productovetorial function, of the Mathematics class, storing the…
-
0
votes0
answers29
viewsHow to access the Python-Shell output outside the function scope
Hello! I’m making an api using Python in the back-end as the python script is all ok! I will receive a sentence in Javascript and through python-shell I will process it in python, until there is a…
-
0
votes0
answers29
viewsSET method does not modify vector attribute on object of a class
Follow the full code: // sistemafinanceiro.h #ifndef SISTEMAFINANCEIRO_H #define SISTEMAFINANCEIRO_H #include"banco.h" class SistemaFinanceiro { private: Banco banco; public: SistemaFinanceiro();…
-
0
votes2
answers25
viewsHow to instantiate a class with predefined and immutable parameters C#
How to instantiate this class jogo? public class Jogo { public string Name { get; set; } public string Genre { get; } public string Plataform { get; } public Jogo(string name, string genre, string…
-
0
votes0
answers35
viewsProblem with class referenced! " Fatal error: Class [...] not found in..."
Good morning, folks. I am developing a login system (MVC) and tracking on youtube. The following error appears: Error to find the class I reviewed the code and couldn’t find the cause. Please, I…
-
0
votes0
answers109
viewsFatal error: Uncaught Error: Class "Source Models Post"
I am unable to instantiate the object, my class inside the source/Models folder <?php namespace Source\Models; use CoffeeCode\DataLayer\DataLayer; class Post extends DataLayer { public function…