Official Forum for Programming in Objective-C (the iPhone Programming Language) - Stephen Kochan
June 24, 2017, 06:49:51 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
   Home   Help Search Login Register Chat  
Pages: [1]   Go Down
  Print  
Author Topic: square programme  (Read 2154 times)
water removal
Newbie
*
Posts: 1


WWW Email
« on: March 17, 2011, 02:40:08 AM »

code fragment:  [self setWidth: s andHeight: s];

Is it legal to use as an alternative to this fragment, the following?

width = s; height = s;
Logged

MarkCooperstein
Newbie
*
Posts: 19


Email
« Reply #1 on: May 19, 2011, 08:53:47 AM »

yes, as long as you are talking about instance variables height and width and you are making assignment within a method where height and width are ‘known’  (ie: rectangle.m or square.m file).  Making the assignment as in:

width = s;
height = s;

might be more efficient from a runtime perspective as it is just making as assignment whereas:

[self setWidth: s andHeight: s];

has more overhead as it is a function call.
Logged
talha_sadi1
Newbie
*
Posts: 1


Email
« Reply #2 on: December 06, 2011, 11:28:47 AM »

It seems that the total program isn't here. when i first learn program by w3school it's lessons are really Conveyancing me. day by day i am improving my skill. now i can make very tiny program. any way thanks
Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Entire forum contents ゥ 2009 classroomM.com. All rights reserved.