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

56770 questions
10
votes
5 answers

create a javascript document Object

Is there any way to create or recreate a javascript document Object by calling a function. Something like I want to do this so I can solve the issue in this…
Rico
10
votes
5 answers

Remove duplicates from an array based on object property?

I have an array of objects. I'd like to remove the duplicates based on the "name" value in the object. [0]=> object(stdClass)#337 (9) { ["term_id"]=> string(2) "23" ["name"]=> string(12) "Assasination" ["slug"]=> …
Drew Baker
  • 13,308
  • 12
  • 50
  • 90
10
votes
5 answers

traversing through JSON string to inner levels using recursive function

I have a JSON input which can go to any number of levels. I'm giving an input sample of var d=getEntities( {"Categories": { "Facets": [ { "count": 1, "entity": "Company", "Company": [ { …
user1371896
  • 1,834
  • 7
  • 22
  • 31
10
votes
2 answers

Javascript array becomes an object structure

I'm experiencing an odd behavior (maybe it isn't odd at all but just me not understanding why) with an javascript array containing some objects. Since I'm no javascript pro, there might very well be clear explanation as to why this is happening, I…
Aidal
  • 591
  • 1
  • 7
  • 19
10
votes
4 answers

All objects in JavaScript are truthy per the spec, but in the DOM one non-primitive object is not. Which?

There is this tweet on Twitter: In JavaScript, all objects are truthy (as per the spec). In the DOM, there’s one exception to this rule. What is it? #jsquiz #fronttrends Does anyone know the answer?
Nicola Peluchetti
  • 72,169
  • 29
  • 129
  • 186
9
votes
2 answers

What kind of object shows up in the console as [object Text]?

Say I have the following element:

Here is some emphasized text!

In a Javascript console, I'll get its contents with jQuery: > var theContents = $('

Here is some emphasized

75th Trombone
  • 1,178
  • 14
  • 26
9
votes
3 answers

Access Dancer Log object?

Normally when using dancer you call, for example debug 'foo'; and it will log the text. But I want to be able to log stuff in an object that doesn't import the dancer syntax. I'm wondering if there's a way to get dancer to just hand me it's log…
xenoterracide
  • 13,850
  • 17
  • 89
  • 196
9
votes
3 answers

object literal notation vs prototype speed and memory

i came across this post http://www.webmasterworld.com/javascript/3066162.htm about how in javascript when you instantiate an object literal if it has methods defined in it then each time one is instantiated its methods are copied as well. so if you…
zero
  • 2,759
  • 7
  • 38
  • 56
9
votes
2 answers

typeof new String("aaa") === "object"? Everything is an object, but there are primitive types?

There will be a lot of questions needing clarifiction, so I'll try to mark them with numbers, to make it easier to respond to it. Lately I have been studying javascript a lot. There is a subject about "everything is an object". In my…
SoonDead
  • 6,334
  • 5
  • 49
  • 80
9
votes
4 answers

Can you create dates that are lower than 271800 BC? Like dinosaur time?

This is as low as I can seem to go with javascript date: var myDate = new Date(0, 0, 1); myDate.setFullYear("-271800"); alert(myDate); Anything lower than -271,800 BC throws an invalid date error. Can we go back a million years? Or a billion? Can…
Devin McQueeney
  • 1,231
  • 2
  • 12
  • 29
9
votes
2 answers

How to control json_encode behavior?

Is there any way to control json_encode behavior on objects? Like excluding empty arrays, null fields and so on? I mean something like when using serialize(), where you can implement magic __sleep() method and specify what properties should be…
gremo
  • 45,925
  • 68
  • 233
  • 380
9
votes
4 answers

Using make to move .o files to a separate directory

I've tried numerous attempts to move my .o files to my obj folder, but no matter what I do, it simply just doesn't work. Judging from the makefile provided, what is the best method to move .o files to a specified folder? BIN = bin/ OBJ =…
zeboidlund
  • 8,829
  • 25
  • 108
  • 176
9
votes
2 answers

How to store objects for later use and make them searchable

At the moment I am using a vector to store pointers to the object every time one is made, but that feels a little silly. There's probably a better way, but I haven't found it. What I'm doing: Example usage: The problem: If I…
natli
  • 3,639
  • 10
  • 44
  • 80
9
votes
2 answers

C# Large objects and heap

I am a bit confused about the storage of large objects within the heap.. Like at what size is the object cosidered large? What types are more likely to be treated as large objects?is there any clear fragmentation methods adapted to manage such…
SShebly
  • 2,004
  • 21
  • 29
9
votes
6 answers

C++ writing an object to a file then later reading it in?

Possible Duplicate: How to serialize in c++? How to implement serialization in C++ I've been toying around with C++ more and more these days and have only had a couple experiences with ofstream at this point. Most of said experiences have been…
HunderingThooves
  • 912
  • 7
  • 19
  • 31
1 2 3
99
100