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

why "Visual wizard" doesn't see (find) my instances?

using System; using System.Collections; using System.Collections.Generic; class Program { public List testL_I_A; // doesn't see "testL_I_A" instance name te = new List(); public enum TypeE{ pistol, shotgun,…
user7855289
1
vote
1 answer

Can I edit the oracle instances property?

When creating a table in Oracle, the Parallel and Degree properties can be specified. When creating a table and selecting * from all_all_tables, there is an INSTANCES item. Can this item be edited by the user using DDL statements such as CREATE…
user13746660
1
vote
2 answers

Instances as attributes (type error positional argument)

I've been trying to work myself through an error: I have a child class with an instance as an attribute. The attribute self.admin_privileges should take Python to the Privileges class and then print out the list attributed to…
1
vote
0 answers

Mocking a neo4j Record instance in a Unittest

I have a method: def retrieve_datetime_and_device(self, response): node_dict = response[0][0]._properties dt = node_dict.get("datetime") device = node_dict.get("name") return dt, device The response is a return from a neo4j query.…
pymat
  • 1,090
  • 1
  • 23
  • 45
1
vote
3 answers

default value for instance variable in the class body

When we write Instance variables in the body of the class and given that the constructor initializes them, then why can we Initialize the variables directly and outside the constructor without going to the constructor? isn't that the constructor's…
amz
  • 32
  • 6
1
vote
0 answers

wrap or decorate instance method of built-in class

Is it possible to wrap a function of an instance of a built-in class, i.e. add functionality to an already created instance of a built-in class? As a concrete example, when parsing xml files using ElementTree, the Element.find method returns an…
1
vote
1 answer

Content from variable and object of my Node Instance isn't getting printed out

Note The program works just fine, the thing is when trying to print the dictionary tree out, it doesn't print the word itself: +++++Spanisch Woerterbuch+++++++ Bitte waehlen Sie eine Aktion aus! Einfuegen 2. Suchen 3. Beenden 1 Bitte…
TorbenIT
  • 259
  • 2
  • 12
1
vote
1 answer

How many dictionaries/parameters for method overloadings?

I can put constraints superclass; I can put constraints on particular methods in the class; I can put extra constraints on instances for the class. Constraints are implemented as dictionary-passing. Does that mean different overloadings for a method…
AntC
  • 2,623
  • 1
  • 13
  • 20
1
vote
1 answer

WooCommerce issue: Object of class WC_Product_Variation could not be converted to int

I built a plugin to access and modify some products fields with the Quick Edit of Woocommerce. In the shop I have Simple and Variable products. Each Variable product has two attribute: Kg and Pièce. What are the different fields ? There are two…
JAGENI Nat
  • 69
  • 8
1
vote
0 answers

javascript can not access class before initialization

I have existing javascript code and I would like to call some new code that is written in typescript an compiled to javascript. I write simple function and from that function I try to instantiate new class. But I get error: Uncaught ReferenceError:…
ramijan
  • 331
  • 1
  • 3
  • 4
1
vote
2 answers

Creating unique instance works, but how to get the reference when calling the class again?

I am trying to create a class that stores all created instances in the class itself by using new and init magical methods together and I want to return an existing class if it was created before. My current code looks like this: class Obj(): _list =…
Ulrich
  • 249
  • 4
  • 10
1
vote
2 answers

How does an instance of "Arbitrary" looks for a tree?

In our CS-Lectures we currently learn about QuickCheck in Haskell. Now I got a task to use QuickCheck with the following tree-type: data Tree = Leaf Int | Node Tree Tree deriving (Eq, Show) I have already written some necessery equations to check…
Mr. Moose
  • 101
  • 8
1
vote
2 answers

How can I make my PyQt5 app oney one instance?

What I want to achieve: when I run application from start menu, app starts (if app not running). If an app is already running, then don't create another instance, just show the previous running app window. What I've tried: created a .txt file in…
Ecto Ruseff
  • 141
  • 1
  • 9
1
vote
2 answers

PHP Creating 2 or more instances of the same object, is it possible to retrieve information from the first object?

I have a little project going and since I am not the best at OOP I have come here for some help. I have a class called "truckinfo" class truckinfo { public $vendor; public $truckcount; public $plate; } now I get the information like…
Dokik
  • 364
  • 2
  • 9
1
vote
1 answer

In Python, how do I check if an instance of my class exists?

I'm making a program that asks the user to login, and I'm wondering how I can make it so it checks if an instance of my Username class exists. Oh and please excuse my sloppy and disorganized coding, I'm not very good at it. quit_login = 1 class…
Chris
  • 13
  • 1
  • 3
1 2 3
99
100