Java Class Instantiation Order

I got this code : public class Sgl { private static Sgl sgl = new Sgl(); private static int count = 0; public static Sgl getSgl() { return sgl; } public static int getCount() { return count; } private Sgl(){System.out.pri...
more »

2017-02-12 20:02 (0) Answers

Ada Generics: Stack vs Heap Clarification

So I have an assignment that says: Please use generic instantiations of packages/classes. Space for each BMR (matrix) must be allocated in the system stack within the generic package/template, probably during generic instantiation! You specificall...
more »

2017-02-05 08:02 (1) Answers

call python3 class with methods

I have a file named: This file contains the following class: Im trying to call my class BrickSetSpider, with its methods, and ultimately return the value of parse_page_urls when running this program like python However, when i ...
more »

2017-01-29 17:01 (2) Answers

PHP how to dynamically instantiate a class

I am new to PHP, and I tried to dynamically instantiate a class like this: $var = new \App\$str; But I keep getting this error: unexpected variable $str after '\', expected: identifier. I know it is possible, but I am just not sure what the ex...
more »

2017-01-24 11:01 (1) Answers

Python class - chaining instance methods

I've started to build my class in this fashion (more like a regular function): ex 1 class Child(Parent): def __init__(self,user): Parent.__init__(self, user) search = filter = api.filter(search) ...
more »

2017-01-03 20:01 (4) Answers

Passing a class and calling a method on it

Consider a class extending Fragment called MyFragmentClass which has newInstance(args) implemented. What I want to do is make a getter for anything extending MyFragmentClass so I can make a new Fragment via newInstance(args). Something like: <T ...
more »

2016-10-30 21:10 (1) Answers

class constructor that calculates input using C#

Hello and thanks for checking my post. New to C# and Oop in general. Learning has been smooth so far but I'm running into issues when I try to create (and call) a constructor that calculates data input by user. If possible: I would like to create 3 ...
more »

2016-10-23 07:10 (4) Answers

MessageShow in another class?

This is my first time trying to implement separate class into form class, rather than just having it all in the form class. How do I go about connecting the two? When the button is clicked, I wanted to be able to have it show the letter grade with Me...
more »

2016-10-18 23:10 (2) Answers

Cannot instantiate class inside itself

I'm writing a blackjack program in Java and I've come across a problem when learning to using inner classes. I'm attempting to instantiate a Blackjack object inside itself to call the inner class Card's methods, but the program cannot find the Blackj...
more »

2016-10-07 09:10 (1) Answers

Instantiate generic type from variable

I would like to instantiate a new object where the type and generic type are defined as variables. The final result could look like the newListOfObjects created manually here: var newListOfObjects = new List<TabViewModel>(); Where TabViewMod...
more »

2016-10-06 09:10 (2) Answers

Class vs Local instantiation

Is there a difference in class and local instantiation when the first one is not obligatory (usually when i can finalize them)? Is there a "rule" i should follow? I have developed the habit to always instantiate other classes using class instantiati...
more »

2016-10-03 18:10 (3) Answers