Questions tagged as 'classes'

2
answers

Initializing Array of a new class

Considering two classes in C #: public class aClass { public string afield; } public class bClass { public aClass[] bfield; } I want to start the variable as bClass cVar = new bClass(); cVar.bfield[0].afield = "text"; but is g...
asked by 05.04.2018 / 21:40
2
answers

What allows Java to find out what the main class is in a .jar

As Java does to find out which is the main class in a file .jar     
asked by 27.10.2015 / 15:54
2
answers

What is the interface for Countable in PHP?

I saw a certain class whose declaration was this way: class Collection implements Countable {} I noticed that she was implementing Countable , but I did not understand what that implementation was doing there. What is the purpose o...
asked by 07.10.2016 / 20:09
1
answer

When should I instantiate a class?

I am doubtful when it is the best time to call instantiate a classe . Should I do this in the beginning, before the constructor, in the constructor or at the time we are going to make use of any method? In the example below I creat...
asked by 24.07.2016 / 15:34
1
answer

What is a class of type "class MyClassExampleT where T: new () {}"?

Is a class ExemploClass<T> class a list? See the example class below: public abstract class MinhaClasseExemplo<T> where T: new() { public T value {get; set;} } What does each part of this expression mean: abstract class M...
asked by 04.01.2016 / 02:12
1
answer

Knowing which child class the parent class points to

I came from java and am having a question about the C ++ polymorphism. Given these classes: class Empresa{ vector<Pessoa> pessoas; int empregados; addPessoa(Pessoa* p) } class Pessoa { ... }; class Empregado:public Pessoa{ ... } c...
asked by 22.10.2017 / 19:00
1
answer

Implementation of classes in the header itself

In my object-oriented studies, I saw many saying that in class creation it is necessary to create a header , containing the class, attributes, and methods, as well as another cpp file to implement the methods. But I'm finding some c...
asked by 19.09.2015 / 17:03
1
answer

How to include the same class in multiple files?

Because I can not include the same class in multiple files like this: #include "familia.h" class pessoa{ private: familia *f; }; ----- #include "pessoa." class familia{ private: pessoa *p; };     
asked by 20.04.2016 / 07:57
1
answer

What is the difference between __CLASS__ and get_called_class?

In PHP, I know two methods of displaying the name of the current class being called: through the magic constant __CLASS__ and the get_called_class() function. Apparently, they both do the same thing. class A { public sta...
asked by 31.03.2016 / 19:08
2
answers

Is InnerClass object created at what time?

I have a class which contains an InnerClass, I would like to know if the moment I give new ClassePrincipal() the InnerClass is also created?     
asked by 03.03.2015 / 19:26