Questions tagged [object]

An object is any entity that can be manipulated by commands in a programming language. An object can be a value, a variable, a function, or a complex data-structure. In object-oriented programming, an object refers to an instance of a class.

Objects in object-oriented programming (OOP) are data structures combined with the associated processing routines. Classes are sets of objects, while objects are instances of sets. Objects have members and methods, defining their properties and their abilities. Classes can have their own members and methods, which define the properties and abilities of the set of objects. For instance, if we have a Bird class, its objects might have an age property and a fly ability, while the Bird class might have a number of birds or a migrate ability, which is applicable for the set. Class-level methods are called static, or shared. For instance, a file could be represented as an object: a collection of data and the associated read and write routines. In typical object-oriented languages, all objects are instances of classes.

Properties of an object

Three properties characterize objects:

  • Identity: the property of an object that distinguishes it from other objects
  • State: describes the data stored in the object
  • Behavior: describes the methods in the object's interface by which the object can be used

See also:

  • (Used as a template for creating new objects)
  • (Object-oriented programming)

Resource

64898 questions
11
votes
2 answers

How do I determine what to put inside the __init__ function in a python class?

So I understand how to use init when defining a class in Python. However, I am confused as to what to put inside the init function, or if I should use it at all. For example: Here I make the user define concept when the class is instantiated: class…
Daniel
  • 363
  • 3
  • 11
11
votes
2 answers

Problem with getDay() method javascript

I'm trying to get the day name in javascript. Every time I search for usage of the function getDay(), it is explained that this method returns the day of the week, for example: 0 is sunday, 1 is monday etc. So the 1st janauary 2010 was a friday, can…
Geraud Mathe
  • 711
  • 2
  • 9
  • 20
11
votes
6 answers

How to deep copy a custom object in JavaScript?

I've been surfing around here a while and still haven't found an answer that worked for me. Is there any way to deep copy a non-plain object in JS? I've tried jQuery.extend(true, {}, this) but it only cloned some of it, the rest remained as a…
Robmeister2015
  • 219
  • 1
  • 3
  • 13
11
votes
1 answer

JavaScript empty object size

What is the memory footprint of an empty object in JavaScript? If object is created using object literal syntax: let emptyObj = {}; in Google Chrome Developer Tools (Profiles tab), after taking snapshot, it shows that Shallow Size as well as…
proxeld
  • 111
  • 5
11
votes
3 answers

Where is the object browser in visual studio C# 2010 express edition?

I am not sure that this is the right place to ask this, but because all here are programmers, maybe someone could help me. I always used 2008 express, I decided to try the 2010 version today. The problem now is that I need to check something in the…
Aaron de Windt
  • 16,794
  • 13
  • 47
  • 62
11
votes
1 answer

Class() returns multiple multiple class names in R

All, I am a beginner in R. I am not too familiar with how classes are organized in R. I have noticed that some class() calls return one class-type, while others return multiple class names. Example 1 {My object name is "sassign"} Here's my data: …
watchtower
  • 4,140
  • 14
  • 50
  • 92
11
votes
6 answers

Best practice for a Java method returning multiple values?

I need a non-static instance method to return multiple values. For the sake of a simple example let's say these are boolean success and Object obj - but in the general case there could be more and they could be unrelated to each other. Can think of…
Steve Chambers
  • 37,270
  • 24
  • 156
  • 208
11
votes
6 answers

How to remove empty values from object using lodash

I have an object with several properties and I would like to remove objects/nested objects that are empty, using lodash. What is the best way to do this? Let template = { node: "test", representation: { range: { } }, …
yesh
  • 2,052
  • 4
  • 28
  • 51
11
votes
4 answers

How do I stringify an array of objects?

I have created an array of objects that needs to be stored and kept for another page. The array of objects is similar to this: var cheese_array = [ { name: "Chedder", age: "34", smelly: true }, { name: "Brie", age: "4", …
sparcut
  • 795
  • 1
  • 10
  • 27
11
votes
3 answers

Javascript map 2 arrays into 1 Object

I have to arrays (Name and State Array) and map them togther into one object with the attrbiutes name and state. Array Name: ["Time", "Riskchanged", "Scope", "Risk4", "Test", "Test(2)"] Array State: ["In Bearbeitung", "Abgeschlossen", "In…
simplesystems
  • 839
  • 2
  • 14
  • 28
11
votes
5 answers

Static Class VS Private Constructor

Today, I have been reading about static class and private constructor. Static Class - We cannot create an instance on the static class. we cannot inherit the static class. Only single instance is generated. Private Constructor - We cannot create an…
KiddoDeveloper
  • 568
  • 2
  • 11
  • 34
11
votes
3 answers

Java Compare complex objects excluding some fields for JUnit

I tried the Unitils tool which is really great, but doesn't provide you an option for excluding fields. The only way by doing this is to set null the objects and enable the IGNORE_DEFAULTS flag, but in my case, it's not helpful, since I've got some…
Harter Oliver
  • 111
  • 1
  • 1
  • 3
11
votes
1 answer

Why would the ES6 class syntax console log differently than an ES5 class syntax?

I am trying to learn ECMAScript 6 more and inheritance a bit better. Question: When I console log out bob vs daisy they differ. bob logs a prototype under __proto__ and shows his constructor of run:true;. On the ES6 implementation daisy has no…
Armeen Moon
  • 18,061
  • 35
  • 120
  • 233
11
votes
3 answers

Am I breaking the "Law of Demeter"?

I just recently became aware of the Law of Demeter. Like a lot of things, I realized that it was something that I was already doing but did not have a name for. There are a few places though that I seem to violate it. For example... I might have an…
Justin
  • 8,853
  • 4
  • 42
  • 42
11
votes
6 answers

How to make a short beep in javascript that can be called *repeatedly* on a page?

This is like the question at: Sound effects in JavaScript / HTML5 but I'm just seeking a specific answer to the issue of repeatability. The above question and other similar ones have helpful answers to use the following javascript: function…
Mark Goldfain
  • 731
  • 2
  • 8
  • 24
1 2 3
99
100