Category "methods"

Pointer receiver method compilation problem: Cannot call a pointer method on 'MyObj{}'

I have the following method defined: func (o *MyObj) parse(something string) string { // Do stuff } This code (1) compiles just fine: (&MyObj{}).parse(

Class is public, should be declared in a file named .java

I'm having this problem which I'm not sure why it's caused. "class Account is public, should be declared in a file named Account.java" I have 5 classes in my

Communication between BroadcastReceiver and Activity - android

I have a broadcast receiver in my app which is fired every time the user gets an incoming call. Now, when it happens, I need the broadcast receiver to invoke a

Safe method to get value of nested dictionary

I have a nested dictionary. Is there only one way to get values out safely? try: example_dict['key1']['key2'] except KeyError: pass Or maybe python h

Why does passing and changing a class self-variable with an external function work for manipulating iterables but not variables?

I ran into a very hard to track down bug in my program where a class self-iterable was manipulated by an external function and discovered that some self-variabl

Having trouble creating overloaded constructor, instantiating an object

I'm new with Java and I'm having trouble going along with my teacher's video lectures (I'm taking an online class), and I'm having trouble with this assignment:

Writing A Recursive Function That Counts Zeros

It is possible to count the number of zeros in an integer through a recursive method that takes a single int parameter and returns the number of zeros the param

how to override the equals() method when you have to compare 7 instance variables? [duplicate]

I am currently doing my programming assignment. But there is one step that i don't quite understand. There are 7 private instance variables an

Should virtual dispatch happen when a virtual method is called within a virtual method using object?

struct B { virtual void bar () {} virtual void foo () { bar(); } }; struct D : B { virtual void bar () {} virtual void foo () {} }; Now we call foo()

Using strings instead of enums?

Is it common place to use a string for comparison as opposed to an enum?