Questions tagged [instantiation]

Instantiation is the process of creating objects from a class in most object oriented and object based languages. In the C++ language, instantiation is the process of creating a class or function from a class template or function template.

2609 questions
0
votes
2 answers

How can I create a class and object for a tkinter widget in Python?

thanks for reading: OBJECTIVE: I am practicing using OOP, and wanted to create a class with class variables for a label widget I'm creating with tkinter. This way I can create many labels and don't need to specify the same font, font size, colors,…
0
votes
2 answers

Setting the parent of a transform which resides in a Prefab Asset is disabled to prevent data corruption

I am facing this problem in Unity again and again. I cannot find solution. I think my code is right, but where is the problem? GameObject visual = Instantiate(placementObject[num], hit.point + visualOffset, Quaternion.identity);…
Dan Rais
  • 159
  • 2
  • 10
0
votes
0 answers

When is a static class variable defined in a function initialised

I have a static instance of a class defined in a function with {} initialiser in C++ Let us say in the function I increment a counter defined in that class. In the constructor I have a print statement. The print statement gets displayed first time…
MTailor
  • 39
  • 3
0
votes
1 answer

how do i access an object that i have just instantiated

So I instantiated an Object but i want to change some of its properties right after instantiating it. So i have to do something like: Gameobject instantiated.GetComponent<>().property = "example Value"; Here is my code so far: public void…
0
votes
1 answer

Syntax for Instantiating JavaScript Date Objects

In JavaScript, it seems you can do either write: new Date().getTime(); ...or: (new Date).getTime(); The first one is logical, but the second one seems a little unusual to me... Is there any difference between these two ways of creating a Date…
Steve Harrison
  • 121,227
  • 16
  • 87
  • 72
0
votes
1 answer

In c++. how to take just a "partial" implementation of a pure abstract class from some class implementation

My Goal: In C# I would write interface A { void fA(); } interface B { void fB(); } interface AB : A, B { } class SomeImplementationOfJustA : A { public void fA() { } } …
ste
  • 1
  • 1
0
votes
1 answer

Is it possible to assign a data attribute to a superclass, within a subclass?

I'd like to assign a data attribute to an instance of my super class taken at instantiation. For example: class Sub(Super): def __init__(self, name): self.name = Super.__init__(self, name) In other words, I want to use as my name what…
Yus Ra
  • 97
  • 1
  • 6
0
votes
1 answer

Load class instance from pickle file during instantiation with HIGHEST_PROTOCOL

Goal When I create an instance of ClassA: if a pickle file exists, then load the instance from pickle file if a pickle file does not exist, then create the instance from scratch use pickle HIGHEST_PROTOCOL. Fail Someone reported here the same…
thomast
  • 122
  • 2
  • 8
0
votes
2 answers

How does one correctly implement a constructor function's instance methods?

Following constructor function and log code is given ... function Car(brand, year, model, color, utilidad) { this.brand = brand; this.year = year; this.model = model; this.color = color; this.utilidad = utilidad; this.useFor = (prmt) =>…
0
votes
3 answers

How to call a value from another class with 3 java classes

I have 3 java class named Author, Book, and DisplayBook. Author class is for setting the name of the author. Book class is for geting details(title, author, price) of the book and DisplayBook is for displaying the output (title, author, price) in…
WiloWisk
  • 137
  • 3
  • 10
0
votes
1 answer

Instantiating Gameobject changes its shape

When instantiating an object from prefab by this way (in an empty project, Unity 2020.3.2f1): myObject = Instantiate(preObject, Parent.transform); This one changes myObject's shape very much. Actually, I don't know why. Found a decision: myObject =…
A1exander
  • 1
  • 1
0
votes
1 answer

2D Instantiated object stops moving when used with timer

Hello I'am trying to make a system that instantiate and object, and the moves it to a set of waypoints. When i use intantiate in the Start() function it travels like intended through the waypoints, but when i add the instantiate line to my update()…
0
votes
3 answers

Class that stores all essential objects is the right way to go?

The problem is a design problem in Object-Oriented Programming that I'm trying to find or think of the best solution for, And not sure of the solutions I have thought of so far. The problem: I wrote a class called ComponentsHub whose idea is to…
InSaNiTy
  • 150
  • 1
  • 9
0
votes
0 answers

Servlet class not instantiated upon "Submit" on JSP --- Servlet instantiating error- HTTP 500 - Eclipse

Getting a HTTP 500 error instantiating a server. java.lang.ClassNotFoundException: com.expend.servlets Following are the troubleshooting steps I have taken Servlet annotation : @WebServlet("/LoginServlet") has been removed and only web.xml was…
Raghu
  • 1,141
  • 5
  • 20
  • 39
0
votes
2 answers

How to instantiate view controller from GIDSignIn method in AppDelegate?

I have my Google Sign In methods within my AppDelegate. Once a user is authenticated with Google, I would like them to be brought from the sign-in page to the homepage. Here's the relevant code in my AppDelegate: var window: UIWindow? func sign(_…
amirbt17
  • 533
  • 1
  • 4
  • 13