Questions tagged [instance]

In object-oriented programming an instance is an occurrence or a copy of an object, whether currently executing or not.

Instances of a class share the same set of attributes, yet will typically differ in what those attributes contain. For example, a class "Employee" would describe the attributes common to all instances of the Employee class. For the purposes of the task being solved Employee objects may be generally alike, but vary in such attributes as "name" and "salary".

Related tags:

5388 questions
1
vote
0 answers

Typescript generic interface with field that references the generic class (not instance) type

Let's say I have a typescript class A, and a class B that extends A class A { static a(): number { return 10; } a_(): number { return 10; } } class B extends A { static b(): number { return 20; } b_(): number { return 20; } } I would like…
ironstein
  • 416
  • 8
  • 23
1
vote
1 answer

IBM Cloud not creating Lite Plan Instance

I do not have any instances in my resource list, but I still get the same message below when I try to create a new instance. Service broker error: You can only have one instance of a Lite plan per service. To create a new instance, either delete…
Anjalla
  • 11
  • 1
  • 2
1
vote
2 answers

Retrieve the "kind" of a Class and Class Instance

I am using Ruby on Rails 3.0.9 and I would like to check if a object is a class or a class instance. For example if I have Article # It is a class name @article # It is an instance of the Article class maybe I may do something like the…
Backo
  • 18,291
  • 27
  • 103
  • 170
1
vote
1 answer

p5js AudioIn function not working on instance mode

I was converting my p5js code to instance mode to run 2 canvases in the same DOM but my p5.AudioIn() function is not working. The error I get is referencing Failed to construct 'AudioWorkletNode'. I have uploaded a screenshot of the error below…
seriously
  • 1,202
  • 5
  • 23
1
vote
1 answer

Visual Studio Code opens multiple instances

Two days ago I installed Visual Studio Code and it worked pretty fine. But now as I am opening Visual Studio Code it's opening multiple instances, how can I solve it..?? Edit: it seems Visual Studio Code opens every file present in the directory in…
Aviral Goel
  • 55
  • 1
  • 1
  • 9
1
vote
1 answer

What is meant by calling a function by its "unqualified" name?

This is the text from the book Data Structures and Algorithms in Java by Goodrich from chapter one giving reasons for use of the this keyword. To allow one constructor body to invoke another constructor body. When one method of a class invokes…
nayan
  • 21
  • 3
1
vote
1 answer

Why can't I use my instance in this trait?

I have this code trait GetCurrentConfigTrait { private static ?object $instance; private ?array $currentConfig; final public static function getCurrentConfig($name) { $class = __CLASS__; self::$instance =…
Orry
  • 659
  • 6
  • 21
1
vote
2 answers

How to create multiple object in loop to keep remember each device uniquely

Creating objects something like this, that all unique objects can be used many ways for handle the all device as require. Current code (this code creates object manually) Device d1 = Graph.create("pc1","", 100, 100, 200, 52) ; Device d2 =…
1
vote
1 answer

Appending an instance issues in python

Having some problems with append(). The intended functionality: User chooses to input car data of print data. If input data is selected, user is asked to provide car make and MSRP. The input is to be stored. When user choses to print - programme…
Arthur
  • 35
  • 6
1
vote
1 answer

How to instantiate a derived class from a base class instance?

I want to use an instance of a base class to an initialized/instantiated derived class like below: class B { //... } class D : B { bool DMember; // dummy example //... } B b = new B(); // fill b members with values, do stuff D d =…
Gigi
  • 158
  • 11
1
vote
2 answers

In p5js instance mode for several canvases p5 object is not defined

I am running a p5.js sketch on a flask server. I want to draw several canvases, so i instanced my code like Daniel Schiffman showed in his "9.11: Instance Mode (aka "namespacing") - p5.js Tutorial"-Video, but when i run the code it gives me…
1
vote
1 answer

Are the instance variables for an object stored in continguous memory

Are the instance variables for an object stored in contiguous memory like elements in an array? Say you have Student class def that has a name, age, and grade instance variable. When an instance of the Student class is constructed, are the instance…
chappie
  • 119
  • 4
  • 12
1
vote
1 answer

Vaadin Multiple Route With Same Component

In my application I have tow screens with two modes. Create & View. Create is a form style one and view is a tabular(Grid in new flow component). Since the two pages have the view page in same format, I created a generic page and assigning routes…
1
vote
1 answer

Why I can't delete (remove) the clearly 'existing instance' of the static list in Python?

My purpose is as below: If a new instance created, the instance must be added to the static list. and when a created instance is deleted, it must be deleted from the static list And finalizer method, 'del()' must be used. The python code I had…
Jeonous
  • 23
  • 4
1
vote
1 answer

Python - serial number for objects instantiated from derived classes

The need to add a serial number unique across all instances of all derived classes must come up frequently. But I can't find a sample. Or a match to my search of stackoverflow. If I instantiate a bird, mammal and worm from three classes all derived…
Playing with GAS
  • 565
  • 3
  • 10
  • 18