Questions tagged as 'classes'

1
answer

What is the "class" constraint in a generic type?

In the line below: public class Tree<TItem> where TItem : IComparable<TItem> This line I'm creating the definition of type TItem where TItem implements the IComparable interface, ie I'm creating a generic ty...
asked by 15.09.2015 / 17:00
1
answer

Why use const after the function?

I noticed in some code from other C ++ programmers that use functions like: bool CClass::isRunning() const { return this->_running; } I understand that in this way it is not possible to modify any member of the class, only serves for...
asked by 16.01.2017 / 20:11
2
answers

Private class in JavaScript

I'm looking for a way to make both attributes and methods invisible so they are not accessible from outside the class. But I also wanted to use the modern approach to do this (classNameClass {}). After many attempts I have taken a different appr...
asked by 08.09.2018 / 16:01
1
answer

What are the differences between Friend and Static classes / members?

What are the differences between classes and member variables friend and static within the definition of a class, including its applications. I know only that members of the static class belong to the class and not to the ob...
asked by 27.02.2016 / 22:20
1
answer

How to get the name of all user classes?

The get_declared_classes function ALL classes defined in PHP, both from the internal PHP library and the user's library. I wanted a function for classes of type: get_defined_functions , which separates PHP core functions of...
asked by 25.09.2014 / 23:10
2
answers

Use static Closures or Closures in PHP?

As of PHP 5.4, Closures , when declared within the context of a method of the class (other than static methods), automatically inherits the funções anônimas as a reference of the class that contains it. Example: class StackOver...
asked by 27.01.2015 / 13:07
1
answer

Differentiate class instance from "instance" interface

Is there any way to differentiate% w / o% w / o% w / o in the code below,% w / o% or another method? var v1 = new MinhaClasse(); IMinhaClasse v2 = new MinhaClasse(); I want to execute a method only if the v1 is "instantiated" from...
asked by 25.06.2015 / 04:16
1
answer

Handling of HashMap between classes (Interpretation and Application)

It's my first question, sorry for the extension, I'm in the following exercise:    Create a Pizza class that has the methodIngredient () that   receives a String with the ingredient to be added. This class   you must also have the getPreco ()...
asked by 13.01.2017 / 03:34
4
answers

OrderBy in T lists

I have a list list<Pessoas> : My class people: public class Pessoas { public String Nome { get; set; } public DateTime Nascimento { get; set; } } Theoretically, I could make a OrderBy like this: Pessoas.Order...
asked by 31.03.2015 / 19:13
2
answers

How to make a constructor like QObject?

Having a new question about an old question, I want to know how to create a class equal to QObject . Basically, I want to know: How to make a copy constructor that does not accept assignment operators? How to make a class that can de...
asked by 12.02.2014 / 18:16