instantiation Questions
1
Initially, I instantiated date01 object in a class, but sometimes the results used to stick despite input had changed. To fix that, I moved the object instantiation of class AjtDateUtils into onPre...
Antagonize asked 16/3, 2024 at 7:25
3
Solved
Here's a snippet in which I instantiate a new content object in my service:
const newContent = new Content(
result.obj.name
result.obj.user.firstName,
result.obj._id,
result.obj.user._id,
);
...
Rock asked 10/4, 2017 at 4:4
5
I'm writing a C++ library that contains a lot of function templates I want to explicitly instantiate and export for several type parameters. In my particular case, I have a lot of numeric function ...
Babbler asked 14/5, 2018 at 21:1
5
Solved
I like the fact that Go doesn't give me a million ways to do simple things – to borrow from The Zen of Python, “There should be one – and preferably only one – obvious way to do it.”
However, I'm ...
Shimmery asked 11/7, 2013 at 23:48
13
I have a class with several methods and there is no constructor among these methods.
So, I am wondering if it is possible to call a method of a class without a creation of an instance of the class...
Choanocyte asked 6/3, 2010 at 21:42
1
Solved
Consider a class template S:
[s.hpp]
template <typename>
struct S
{
void f() { /* ... */ }
void g() { /* ... */ }
};
This class template also comes with a source file containing a speciali...
Peptonize asked 17/3, 2023 at 1:37
10
Solved
Is it possible to declare a variable in c++ without instantiating it? I want to do something like this:
Animal a;
if( happyDay() )
a( "puppies" ); //constructor call
else
a( "toads" );
Basial...
Feckless asked 29/4, 2009 at 0:16
32
Solved
Due to the implementation of Java generics, you can't have code like this:
public class GenSet<E> {
private E a[];
public GenSet() {
a = new E[INITIAL_ARRAY_LENGTH]; // Error: generic arr...
Philan asked 9/2, 2009 at 17:30
5
I want a way to make functor from function. Now I trying to wrap function call by lambda function and instantiate it later. But compiler says than lambda constructor is deleted.
So is there any wa...
Efficient asked 17/6, 2012 at 16:11
12
Solved
I have a file: Base.h
class Base;
class DerivedA : public Base;
class DerivedB : public Base;
/*etc...*/
and another file: BaseFactory.h
#include "Base.h"
class BaseFactory
{
public:
BaseFac...
Submarine asked 24/2, 2009 at 15:59
11
Solved
I've created a class with properties that have default values. At some point in the object's lifetime, I'd like to "reset" the object's properties back to what they were when the object was instant...
Tavares asked 2/4, 2009 at 4:56
5
Solved
From Oracle's Java tutorials I've found this text:
As with class methods and variables, a static nested class is associated with its outer class. And like static class methods, a static nested c...
Hm asked 17/8, 2013 at 22:25
2
Solved
Consider this code snippet,
template<bool b>
struct other
{
static const bool value = !b;
};
template<bool b>
struct test
{
static const bool value = b || other<b>::value;
};
...
Fennie asked 5/1, 2011 at 3:24
6
Ive looked and tried but I can't find an answer.
In PHP, is it possible to call a class' member function (when that class requires a constructor to receive parameters) without instantiating it as...
Rawdan asked 23/6, 2010 at 4:6
3
Solved
Don't ask me why but I need to do the following:
string ClassName = "SomeClassName";
object o = MagicallyCreateInstance("SomeClassName");
I want to know how many ways there are to do this is an...
Chucklehead asked 24/3, 2012 at 19:41
3
I am trying to add Room database with Android ViewModel. I followed this link for the same https://codelabs.developers.google.com/codelabs/android-room-with-a-view/#13
I am getting an exception :
...
Loony asked 27/4, 2020 at 15:22
0
Within the C++ language, many will come across various design patterns that have a designated name in which we would call an Idiom, such as SFINAE, RAII, CRTP, Polymorphism, etc...
Consider this fo...
Overleap asked 6/2, 2021 at 16:53
7
Solved
I'm new in programming and I would like to know where did I go wrong in instantiating an object. Below is the code:
public class Testing{
private int Sample(int c)
{
int a = 1;
int b = 2;
c =...
Enchantress asked 1/8, 2013 at 5:59
1
Solved
For example, in java:
public class App {
public void method() {
Object1 o1 = new Object1(new Object2(parameters));
}
}
I know App and Object1 have a composition relationship.
But what about ...
Alleneallentown asked 1/10, 2020 at 1:17
5
Solved
Say I want to init a UIView subclass with a String and an Int.
How would I do this in Swift if I'm just subclassing UIView? If I just make a custom init() function but the parameters are a String ...
Decor asked 21/6, 2014 at 6:49
2
I have created a web app project in Firebase. And added all the the Firebase configuration scripts including api keys provided for project. I want to integrate Google Sign-in in web app using fireb...
Pulverize asked 4/8, 2018 at 16:51
3
Solved
I'm trying to do some conditional work like so:
Type object;
if (cond) {
doSomeStuff();
object = getObject();
doMoreStuff();
} else {
doSomeOtherStuff();
object = getDifferentObject();
doEven...
Gwenny asked 29/6, 2020 at 21:38
8
Solved
I have the following class:
class ReportView: NSView {
var categoriesPerPage = [[Int]]()
var numPages: Int = { return categoriesPerPage.count }
}
Compilation fails with the message:
Instan...
Headdress asked 2/9, 2015 at 10:59
6
My full code is too long, but here is a snippet that will reflect the essence of my problem:
class BPCFGParser {
public:
...
...
class Edge {
...
...
};
class ActiveEquivClass {
...
...
Leena asked 12/12, 2009 at 19:59
9
Solved
What is the difference between Class.forName() and Class.forName().newInstance()?
I do not understand the significant difference (I have read something about them!). Could you please help me?
Residuary asked 19/1, 2010 at 10:11
1 Next >
© 2022 - 2025 — McMap. All rights reserved.