tagged [oop]

How to get a JavaScript object's class?

How to get a JavaScript object's class? I created a JavaScript object, but how I can determine the class of that object? I want something similar to Java's `.getClass()` method.

27 Dec at 13:4

What is the difference between a field and a property?

What is the difference between a field and a property? In C#, what makes a field different from a property, and when should a field be used instead of a property?

20 Jul at 04:54

Why can an abstract class have constructor?

Why can an abstract class have constructor? Why does an abstract class have constructor? What's the point? It's obvious that we cannot create an instance of an abstract class.

13 Nov at 03:24

What does Method<ClassName> mean?

What does Method mean? I've seen this syntax a couple times now, and it's beginning to worry me, For example:

1 Jul at 16:44

Are global static classes and methods bad?

Are global static classes and methods bad? It's generally agreed upon that relying heavily on global stuff is to be avoided. Wouldn't using static classes and methods be the same thing?

30 Jun at 18:28

why can we declare delegates outside a class? Is it not against OOP concept?

why can we declare delegates outside a class? Is it not against OOP concept? According to oops fundamentels, everything has to be inside a class. Then why are we allowed to create delegates outside a ...

31 May at 14:49

What is the reasoning behind the Interface Segregation Principle?

What is the reasoning behind the Interface Segregation Principle? The Interface Segregation Principle (ISP) says that many client specific interfaces are better than one general purpose interface. Why...

What is the difference between __init__ and __call__?

What is the difference between __init__ and __call__? I want to know the difference between `__init__` and `__call__` methods. For example:

What is the difference between old style and new style classes in Python?

What is the difference between old style and new style classes in Python? What is the difference between old style and new style classes in Python? When should I use one or the other?

OOP vs Functional Programming vs Procedural

OOP vs Functional Programming vs Procedural What are the differences between these programming paradigms, and are they better suited to particular problems or do any use-cases favour one over the othe...

Inheritable only inside assembly in C#

Inheritable only inside assembly in C# In C# Is there way to specify a class to be inherited only by a class present in the same assembly and for other assemblies should behave like a public sealed ty...

10 Mar at 13:56

Why are methods virtual by default in Java, but non-virtual by default in C#?

Why are methods virtual by default in Java, but non-virtual by default in C#? In Java, methods are virtual by default; C# is the opposite. Which is better? What are the advantages and disadvantages in...

19 Dec at 21:33

Interface or an Abstract Class: which one to use?

Interface or an Abstract Class: which one to use? Please explain when I should use a PHP `interface` and when I should use an `abstract class`? How I can change my `abstract class` in to an `interface...

24 May at 16:11

why main method in c# is always placed inside the class but not in c++

why main method in c# is always placed inside the class but not in c++ Why we put `main()` method always inside the `class` in C# while in c++ it always placed outside of the `class`.

25 Jan at 12:48

Partial class in PHP like we have in C#

Partial class in PHP like we have in C# Is there any simple way to have a concept of in like we have in ? I've tried to make it possible using different namespace but it couldn't work.

9 Feb at 09:59

How to use internal class of another Assembly

How to use internal class of another Assembly I have a third party assembly and I would like to use its `Internal` class in my new C# project. Is it possible? Any example would really be appreciated

26 Nov at 08:51

What does Resharper mean by "Object allocation (evident)"?

What does Resharper mean by "Object allocation (evident)"? Resharper highlights the new keyword in my code with a hint "Object allocation (evident)". What does this mean? ![Resharper highlighting "Obj...

1 Jan at 23:28

Creating an empty object in Python

Creating an empty object in Python Are there any shortcuts for defining an empty object in Python or do you always have to create an instance of a custom empty class? Edit: I mean an empty object usab...

20 Oct at 11:27

Static Method of a Static Class vs. Static Method of a Non-Static Class ( C# )

Static Method of a Static Class vs. Static Method of a Non-Static Class ( C# ) I was asked the above question in an interview. Could you please explain the differences? ( performance - memory - usage ...

15 Feb at 16:33

how to convert ListItemCollection (dropdownlist.items) to a dictionary<string,string>?

how to convert ListItemCollection (dropdownlist.items) to a dictionary? How to convert `ListItemCollection` (`DropDownList.items`) to a `Dictionary`(I know it can be done through for each loop) is the...

4 Jun at 06:13

When to use an interface instead of an abstract class and vice versa?

When to use an interface instead of an abstract class and vice versa? This may be a generic OOP question. I wanted to do a generic comparison between an interface and an abstract class on the basis of...

Why should constructors on abstract classes be protected, not public?

Why should constructors on abstract classes be protected, not public? ReSharper suggests changing the accessibility of a `public` constructor in an `abstract` class to `protected`, but it does not sta...

Abstract Class Constructor

Abstract Class Constructor > [Why can’t I create an abstract constructor on an abstract C# class?](https://stackoverflow.com/questions/504977/why-cant-i-create-an-abstract-constructor-on-an-abstract-...

23 May at 10:32

Is serializable attribute needed in concrete C# class?

Is serializable attribute needed in concrete C# class? In C#, consider we have a class and a class is it necessary to mark ConcreteUser as `[Serializable]` or inheritance will take care of it?

15 Nov at 12:50

What is the difference between a class and a datatype?

What is the difference between a class and a datatype? I have heard the following statement: > We can say class is a datatype or a datatype is one type of class. Can anyone explain to me what exactly ...

2 Mar at 07:18