Skip to main content

Questions tagged [object-oriented]

For questions about object-oriented concepts including encapsulation, polymorphism, and inheritance, or for questions about object-oriented languages that are built around these concepts.

8 votes
1 answer
1k views

JavaScript has a handful of primitive types such as strings and numbers. However, when doing something fancy, it often wraps these types inside temporary objects in order to use object methods, a ...
Manngo's user avatar
  • 181
4 votes
1 answer
223 views

In many OOP languages with explicit inheritance/interface implementation, code can be "shared" or reused through method inheritance from the parent type, or through default implementations ...
Daniel Vernall's user avatar
1 vote
0 answers
134 views

In languages that has a distinction between virtual and non-virtual functions, it is suggested to make the destructors of polymorphic objects virtual, because otherwise if a pointer to the base class ...
user23013's user avatar
  • 3,314
2 votes
1 answer
335 views

I'll focus on the == operator in C++. Its usual declaration signature for overloading is: ...
Dannyu NDos's user avatar
  • 1,485
6 votes
1 answer
484 views

I am an object-oriented developer professionally, but I have researched functional programming and (believe that) I understand the key principles which to varying degrees are applied in FP languages. ...
Daniel Vernall's user avatar
-1 votes
1 answer
347 views

Linus Torvalds has famously attacked the object-oriented language C++, but he didn't offer many specifics about why, besides saying C++ uses "inefficient abstracted programming models". What ...
Geremia's user avatar
  • 109
0 votes
1 answer
331 views

Context: Let us assume a full-lattice type theory with at least types any, bool, Exception, <...
feldentm's user avatar
  • 2,498
7 votes
0 answers
339 views

A reference or level-0 copy is the same object as the original, only accessed differently. A level-1 shallow copy is a new object, with every member a reference to the member under the same name in ...
user23013's user avatar
  • 3,314
5 votes
1 answer
367 views

Let us assume a language that has final with Java semantics, i.e. a final type cannot have subtypes. Further, let that language have a full lattice type theory with at least one bottom type, e.g. ...
feldentm's user avatar
  • 2,498
4 votes
4 answers
565 views

In an object oriented language with single inheritance, there is often the concept "interface", separate from classes, as a replacement of what would otherwise require multiple inheritance. ...
user23013's user avatar
  • 3,314
7 votes
1 answer
463 views

A problem I sometimes run into when using a language like TypeScript or C# is how they lack a perfect analogue to Haskell's typeclasses. Let's use Haskell's Functor ...
Kilian Kilmister's user avatar
2 votes
1 answer
602 views

After playing around Python a little bit, I feel like Python does not encourage us to read objects's content. Take JavaScript for example: just a simple act of calling an object will list all the ...
Ooker's user avatar
  • 175
4 votes
2 answers
485 views

Some languages offer the feature of properties, different from normal member variables, that trigger some code when you read from or write to the property. The triggered code are called accessors. The ...
user23013's user avatar
  • 3,314
4 votes
2 answers
615 views

In the class definitions of an object oriented language, this refers to the object instance the code is about to work upon. Naturally, it should have the same type ...
user23013's user avatar
  • 3,314
11 votes
3 answers
406 views

In some languages, all classes have an implicit superclass. For example, Object in Java/Python and Any in Kotlin. All classes ...
FireTheLost's user avatar
  • 1,661

15 30 50 per page