ES6 Classes - Updating Static Properties

I am trying to figure out alternative ways to set a static (or class) property an ES6 Class and then change it after new instances of the class are created. For example - Lets say I have a class called Geo, and I need a static property called 'all'...
more »

2017-05-20 23:05 (1) Answers

Lists as default arguments?

I recently stumbled upon something weird (well at least I perceive it that way): In [1]: class A(object): ...: def __init__(self, name, l=[]): ...: self.name = name ...: self.l = l ...: In [2]: a = A("a") I...
more »

2017-05-20 23:05 (0) Answers

bootstrap class conflicts with another class

Im stuck at a stupid problem, and I really can't figure out how to solve it. I've built a multilevel select box, and the second contains result of whats choosen in the first one. Im using bootstrap selecpicker to style my select boxes, but the sele...
more »

2017-05-20 23:05 (0) Answers

Multiple Nested Classes Java

Hi so I have a class that has mulitple layers of nested classes within it and I was wondering why it does not work. For some reason I cant create a new StackNode I was wondering why that might be. public class MultiStack { Stack1[] arr; int...
more »

2017-05-20 20:05 (1) Answers

Java Objects and arrays

I'm relatively new to java and i'm wondering how to go about writing this set of code. Currently I have a class to create an object for each name and number pairs from a list the user inputs public class Data { private String x; private int...
more »

2017-05-20 19:05 (2) Answers

Python - Accesing a list from another class method

I have a little problem with two different classes and two methods from the same class. I have a class B which is using both methods from class a which seems to work fine. The problem however is that the first method from class a (insert) changes a ...
more »

2017-05-20 12:05 (1) Answers

Class "Nebula" does not exist

I am having issues with Processing 3.3. I am just starting on a type of nebula simulator, meant to simulate the birth and life cycle of a star from a nebula to red giant. I have created two classes so far: Gas, for each individual gas particle, and N...
more »

2017-05-20 01:05 (1) Answers

Python classes: Code Review

I'm new to Python and I'm trying to practice working with classes. I have this program I want to make using classes that takes two sides of a triangle (the user provides the two sides) and then returns the calculated remaining side (Pythagorean Theor...
more »

2017-05-19 00:05 (0) Answers

I know struct is a class but the code says No

I was trying to convince a friend that struct is just a class in the modern C++. After a lot of arguing and resource exchange (including some SO Q&A), I came into an idea to prove it through code, so I wrote: class A {}; struct B {}; int main()...
more »

2017-05-18 22:05 (3) Answers

Iterate over array of objects from txt file

I have file with records separated by comas: cities.txt: 1,NYC 2,ABQ ... I would like to iterate over each row: ids and names. I have created the code: #include <iostream> #include <string> using namespace std; class City { int ...
more »

2017-05-18 10:05 (2) Answers