objective c - Problem calling class methods (Q:1) -


i'm trying convert old 'c' program containing static methods obj-c i'm having few problems getting compile. in header file i've got:

@interface anneal : nsobject ... ... +(float)approxinitt; -(costtype)simulatedannealing; ... 

and in implementation file, 2 problem methods (also cut-down brevity):

@implementation anneal  +(float)approxinitt {     float t=0.0;     int m2=0;      ...      if(m2==0)         t = t_lifesaver;     else         t = t / m2 / log(initprob);     return t; }  -(costtype)simulatedannealing {     float t;      ...      if(tset)         t=initialt;     else         t=[self approxinitt]; // error:incompatible types in assignment } 

unfortunately i'm getting "incompatible types in assignment" error though 't' , return class method both of type 'float'. while code contains multiple source files (from i'm expecting hit few more problems in next few days), they're both in same one. problem caused error in way i'm calling 'approxinitt()' search of internet hasn't uncovered answers prob far.

as novice don't have experience in multi-model code or using static/class methods, , i'd sure appreciate this. in advance :-)

class methods donot belong particular instance of class. so, try passing message class -

t = [ anneal approxinitt ]; 

Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -