Questions tagged as 'classes'

2
answers

Doubt about function in C ++ that works as a destructor? [closed]

I understood all the code below but in certain part the person quotes something as a destructor? What is it? What's the use? It would be this part here: ~Vetor() { delete [] vet_pos; delete [] vet; } Why is this ~ next to...
asked by 25.10.2018 / 21:24
2
answers

How to assign a class to the whole and not only the attributes separately?

I have a class constructor method that when called makes a query in another database class that returns me the same class as the constructor method ( only with assigned data ), eg public Invoice(int id) { CallDB db = new CallDB(); Invoic...
asked by 29.12.2017 / 13:41
1
answer

Classes 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) {...
asked by 16.04.2018 / 14:54
1
answer

What is the difference between a state (referring to the State Machine) and a class?

I would like to know how to differentiate a state, an interface of a class, what are its main differences? How can I distinguish them?     
asked by 05.04.2017 / 18:46
2
answers

Class 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 receives parameters like nome , endereco and telefone . I'd like to use a construct...
asked by 28.02.2017 / 03:08
2
answers

C ++: header file not recognizing class

I'm working with several classes, and to organize myself better, I put each class in a different file. actor.h #ifndef ACTOR_H #define ACTOR_H #include "SDL.h" #include <string> #include "collision.h" #include "world.h" class Actor...
asked by 04.06.2017 / 01:32
2
answers

Static method calling an object

Because PHP allows me to use so, as below, the script runs normally. Would not it be incorrect, or not? Is the :: adder not just for static methods? I was trying to access an object by a static method. But I think I'm incorrect in that wa...
asked by 08.08.2016 / 00:56
1
answer

Call class function: MinPDO :: connect ();

I have a class called MinPDO and inside it a function called connect : class MinPDO { public $sgbd = "mysql"; public $dbhost = "localhost"; public $dbname = "minpdo"; public $dbuser = "root"; public $dbpass =...
asked by 26.12.2015 / 18:45
3
answers

Undefined reference compiling with g ++

I usually use g ++ to compile my code, but now that I've started to learn template I can not compile for anything, the following error appears: g++ -c pilha.cpp pilha-infinita.cpp g++ pilha.o pilha-infinita.o -o pilha.exe pilha-inf...
asked by 26.03.2015 / 15:06
4
answers

Access config.php variables

I am a beginner in php and I have a problem, I have a config.php file like this: <?php $config['dbHostname'] = 'localhost'; $config['dbUser'] = 'teste'; $config['dbPassword'] = 'passteste'; But I have a class with connection and database...
asked by 08.04.2014 / 05:35