superclass

Calling variable superclass method

I'm trying to call a method of the superclass by using a variable method name. Normally, I would see the following two lines of code as equivalent: someObj.method() someObj.__getattribute__( 'method' )() And in fact I believe, this is also what actually happens when I use the first line. However, in the following example, the second l...

warning: incompatible Objective-C types assigning superClass to subClass

Assume a valid super class, and a valid subclass ie the classes work. the following line in a constructor of the subclass self = [super init] ; throws the following warning // warning: incompatible Objective-C types assigning 'struct Animal *', expected 'struct Cat *' Any ideas on how to fix this and remove the warning ? Cheers ...

why does initializing subclasses require calling the super class's same init function?

I have heard that when you have a subclass, you are supposed to initialize the superclass with the same init function from within the subclass's init. What I mean is that the subclass's init should call [super init] and the subclass's initWithFrame should call [super initWithFrame]. Why is this? Why does calling the super's init from ...

General 'map' function for Scala tuples?

Hi, I would like to map the elements of a Scala tuple (or triple, ...) using a single function returning type R. The result should be a tuple (or triple, ...) with elements of type R. OK, if the elements of the tuple are from the same type, the mapping is not a problem: scala> implicit def t2mapper[A](t: (A,A)) = new { def map[R](f: A...

Custom Linked List - Cannot cast object class to object

For this project I'm not allowed to use generic classes keep in mind. I have tried copying all my classes into another friends computer and he gets the same error. I cannot make calls like.. int counter = ((Movie) movieList.get(movListIndex)).getShowList().size(); Where getShowList() is a method in my Movie class that returns a Linke...