Questions tagged as 'classes'

2
answers

How to list methods of a class in C #?

Once again I have to say this: I come from PHP and I'm learning C # now. I usually like to list the methods the class has, since I always did this in PHP, to test or debug. $a = new ArrayObject(); get_class_methods($a); What about C #?...
asked by 17.05.2016 / 22:21
2
answers

Why in class declarations in Python should we extend object?

No Python , when we declare a class, we extend object . class StackExchange(object): def __init__(self): pass I do not know if I'm wrong, but I had the impression that in some versions this is mandatory; and not in o...
asked by 04.03.2015 / 21:34
4
answers

Regarding object orientation, should queries have a class of their own or can they be in a specific class?

What I have is the following: a user class and a connection class with the bank. I need to insert a user into a database, the query " insert into usuarios values (..) " should be in my user class or in the database class? I think o...
asked by 11.12.2015 / 15:02
2
answers

Where should I declare an instance variable in JavaScript?

I'm in doubt about creating instance variables in a class / JavaScript constructor function. I have read in several places that the declaration of an instance variable is made inside the body of the class as in the example below: function Spam...
asked by 11.01.2014 / 15:33
1
answer

Reasons to use private class

When I started in the area, in an OOP course the teacher explained about access modifiers ... I remember that the same day he said that it would be possible to create a private class, but he did not see a reason for doing so. Why can you d...
asked by 11.04.2018 / 21:59
4
answers

How to create a variable where access its properties via string?

I would like to access by string the properties of an object: (EXAMPLE 1) var cor = casa["cor"]; var tamanho = casa["tamanho"]; Instead of access like this: (EXAMPLE 2) var cor = casa.cor; var tamanho = casa.tamanho; Creating this wa...
asked by 13.10.2015 / 18:42
5
answers

What is sealed in C #?

I saw a class in C # that was declared like this, in an answer I read in SOen: public sealed class Link { // Resto do código } What is the keyword sealed in the above case?     
asked by 14.06.2018 / 19:54
3
answers

Generic class property

I have a class with two properties ( Name and Value ). The property Name is a string , already the property Value want to leave the type variable. public class Field<TValue> { public string Name { get...
asked by 27.09.2017 / 19:11
1
answer

Variable within pointer of a class

I have several header files with GUI management functions that I did to create windows, similar to those libraries like GTK, QT and others, and I am transforming them into a library, but I have a problem that is going to be a bit complicated to...
asked by 06.12.2014 / 18:56
5
answers

Optimize function to include classes also looking in sub-directories

I have the following function to include classes when we are trying to use a class that has not yet been defined: /** * Attempt to load undefined class * @param object $class_name object class name */ function __autoload($class_name) {...
asked by 16.01.2014 / 16:40