Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old Dec 7, 2012, 10:51 AM   #1
Mvkoe
macrumors member
 
Join Date: Aug 2008
Location: Belgium
Objective-C / Java Question

Hey

So I'm learning Objective-C with a Java background. It turns out quite good atm. I'm dutch and learning it with a English book. Sometimes I'm not understanding things, but that's why i'm asking it here!

In Java you have a Default Constructor, and you can edit the constructor like in the example.

Code:
	public Date (int day, int month, int year){
		setYear(day);
		setMonth(month);
		setDay(year);
	}
How is this handeled by Objective-C, anyone has an example for this ?

Further I know you can't really use get in your Getter methods because Cocoa would argue sometimes.

Code:
public class Date {

	private int year;
	private int month;
	private int day;
	
	public Date (){
		
	}
	
	public Date (int day, int month, int year){
		setYear(day);
		setMonth(month);
		setDay(year);
	}
	
	public void setYear(int year){
		
	}
	
	public void setMonth(int month){
		
	}
	
	public void setDay(int day){
		
	}
	
	public int getYear(){
	
	}
	
	public int getMonth(){
	
	}
	
	public int getDay(){
	
	}
}
Mvkoe is offline   0 Reply With Quote

 
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 03:25 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC