Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > Mac OS X Development Forums > Objective-C, Python, Ruby Development

Reply
 
LinkBack Thread Tools Display Modes
Old 08-08-2011, 01:07 AM   #1 (permalink)
Registered Member
 
Join Date: Aug 2011
Posts: 1
html_dns is on a distinguished road
Default Understanding class objects?

I've been self teaching myself Objective-C for the past week, having trouble understanding this concept. An extract from the book I'm reading says
Quote:
To get a class object from a class name, you write the following,
[Square class]; // where Square is the class name.
From reading this what I understand is that sending the message 'class' to a class name returns an object of that type?

So following this logic, would
Code:
Square* sqaure = [[Square alloc] init];
               // equivalent to 
Square* square = [Square class];
html_dns is offline   Reply With Quote
Old 08-11-2011, 03:58 AM   #2 (permalink)
Senior Member
iPhone Dev SDK Supporter
 
Join Date: Jan 2010
Location: Issaquah, WA
Age: 42
Posts: 1,244
dljeffery is on a distinguished road
Default

No, [Square class] would return the class object Square, not an instance of Square.

The docs use the "class" message in the examples for calling isKindOfClass and isMemberOfClass. I'm not sure that the "class" message would have any other valid use.
__________________
Recall It! Tag your notes. Tag your photos. Tag your thoughts. Tag your life.

Recall It! for iPad

http://www.dljeffery.com
dljeffery is offline   Reply With Quote
Reply

Bookmarks

Tags
class method, class name, class object, message, runtime

Thread Tools
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
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 476
14 members and 462 guests
7twenty7, AlanFloyd, AppsBlogger, David-T, HemiMG, iAppDeveloper, imac74, Jaxen66, lovoyl, mutantskin, Paul Slocum, SLIC, unicornleo, usernametaken
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,683
Threads: 94,131
Posts: 402,932
Top Poster: BrianSlick (7,990)
Welcome to our newest member, unicornleo
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 10:16 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0