Jump to content
Welcome to InsanelyMac Forum

Register now to gain access to all of our features. Once registered and logged in, you will be able to contribute to this site by submitting your own content or replying to existing content. You'll be able to customize your profile, receive reputation points as a reward for submitting content, while also communicating with other members via your own private inbox, plus much more! This message will be removed once you have signed in.

  • Announcements

    • Allan

      Forum Rules   04/13/2018

      Hello folks! As some things are being fixed, we'll keep you updated. Per hour the Forum Rules don't have a dedicated "Tab", so here is the place that we have our Rules back. New Users Lounge > [READ] - InsanelyMac Forum Rules - The InsanelyMac Staff Team. 

Objective C/C++ Pointers using . ?

2 posts in this topic

Recommended Posts


I'm starting to get more comfortable using Objective C++ coming from a C/C++ background.

I'm just realizing one of the things that has been confusing me, so I'm wondering if anyone can help me figure it out.

Basically what I realized is that pointers in Objective C++ or Objective C can have . operators (?) to access members, but in C and C++, pointers need -> to access members. I notice that when I access my C and C++ members of objective C++ classes (?), I have to use . to access Objective C++ members (properties?), while simultaneously using -> to access C and C++ members. What is going on with this? What is the meaning of using a . on a pointer in Objective C++? Do I simply have to make pointers of objective C++ class pointers to get objects the way I think of them in C++?

Thanks in advance,


Share this post

Link to post
Share on other sites

In objective C, pointers uses the asterisk * to denote a pointer. The period is used when you have properties of an object for instance:




@interface MyClass : NSObject

NSObject *Cars;  // an object car

int weight,speed; // just two integer values

// declare the properties of the Class
@property(nonatomic) int weight;
@property(nonatomic) int speed;


Then in your implementation file aka the .m file


@implementation MyClass

@synthesize weight,speed; // must synthesize properties you create

// now you may use the properties

 Car.weight = 1593;
 Car.speed = 155;


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.