Questions tagged as 'classes'

2
answers

Create instance of class dynamically PHP with Namespace

$class = ucfirst(strtolower($_GET['type'])) . "Controller"; include $class . ".php"; $item = new $class(); But if I put the class name without being dynamically, for example: $item = new PessoaController(); It is accepting nor...
asked by 29.04.2014 / 22:28
1
answer

Which class identifier should I use?

There are several functions that can be used to identify classes in R (or at least "think" for this purpose), such as: class() mode() typeof() storage.mode() str() That, with a simple example: x<-(1:5) class(x) # [1] "integer" mode(x)...
asked by 20.10.2018 / 03:47
2
answers

how to access the array of classes with jQuery? Catching the second class of an element

I'm listing the icons of a list in console.log() they are displayed, however I want to capture only the second classes of the icons in a variable, but I do not know how to access the second classes of the <i> tag with jQuery....
asked by 24.07.2018 / 01:01
3
answers

How to make a polymorphic pointer with this pointer in the parameter?

For example, in Qt (correct me, if logic is wrong, I have not done Qt for a long time), you can do this: QLabel label = new QLabel(this); Now let's suppose: #include <iostream> class AbstractBase { public: virtual void A...
asked by 11.02.2014 / 17:22
2
answers

PHP - Convert XML to Object

Is there a way with PHP to transpose an XML into an object and object in xml? Example: ** Classe (objeto) ** <?php class Telefone { private $codigoArea; private $numero; public function setCodigoArea($codigoArea) { $this->c...
asked by 03.08.2018 / 16:36
1
answer

How do I create an optional parameter in a class method?

I know that to create an optional parameter in a function you can do this: void exemplo(int a,int b=0); But how do I do this in a function of a class ex: class Exemplo{ public: void nada(int,int); }; void Exemplo::nada(int a,int...
asked by 02.02.2018 / 21:57
1
answer

Organization of classes

I need to create a posts system. I'm having trouble studying class and I'm not sure which one to use: class publicarPost {} class excluirPost {} class curtir {} or class Post { function publicarPost(){} function excluirPost(){} fu...
asked by 25.03.2018 / 07:27
1
answer

Difference between vector of pointers for a class and vector for a class?

When is pointer to class will we have to allocate memory space? What is the difference between the following two statements and when should they be used? Vector <class*> nameOfVector; Vector <class> nameOfVector;     
asked by 15.12.2016 / 14:32
1
answer

How to access variables of another class of objects by array?

I have 2 Classes, which are: Path and Costs . Path : public double getKmPercorrida() { return kmPercorrida; } public void setKmPercorrida(double kmPercorrida) { this.kmPercorrida = kmPercorrida; } public double getValorCombustiv...
asked by 09.12.2016 / 02:47
1
answer

How to send variable value into class php?

I've been perfecting secure database connection techniques, and got to the script below. <?php class query_sql { protected static $conect; private function __construct() { $mysql_host = ""; $mysql_base = ""; $mysql_user = "";...
asked by 28.09.2016 / 10:44