1) Install the GNU Objective-C compiler:
sudo apt-get install gobjc
2) Write a quick bit of test code:
// hello.m
#import <objc/Object.h>
#import <stdio.h>
@interface Number: Object
{
@public
int number;
}
- (void)printNum;
@end
@implementation Number: Object
- (void)printNum
{
printf("%d\n", number);
}
@end
int main(void)
{
Number *myNumber = [Number new]; // equal to [[Number alloc] init]
myNumber->number = 6;
[myNumber printNum];
return 0;
}
3) Compile it:
gcc -o hello hello.m -Wall -lobjc
4) Run it...!
./hello
分享到:
相关推荐
How to run ubuntu on windows10,介绍如何在WIN10的系统里面打开Ubuntu.
How to install mysql on ubuntu
How to install apache on ubuntu
How to install ssh on ubuntu
A Guide to MATLAB Object-Oriented Programming is the first book to deliver broad coverage of the documented and undocumented object-oriented features of MATLAB®. Unlike the typical approach of other ...
How to install openjdk on ubuntu
With more than 30 fully hands-on activities, you'll discover how to transform a simple model of an application into a fully-functional C# project, including designing the user interface, implementing ...
and make them your own Understand objects in Google Chrome developer tools and how to use Them Use a mix of prototypal inheritance and copying properties in your workflow Apply reactive programming ...
In The Principles of Object-Oriented JavaScript, Nicholas C. Zakas thoroughly explores JavaScript's object-oriented nature, revealing the language's unique implementation of inheritance and other key ...
Written by a developer for developers who want to make the leap to object-oriented technologies as well as managers who simply want to understand what they are managing, The Object-Oriented Thought ...
You won\'t just learn UML diagramsyou\'ll learn how to apply UML in the context of OO software development. <br>Drawing on his unsurpassed experience as a mentor and consultant, Larman helps you ...
Later, you'll see how to combine functional programming with object-oriented programming and find out how to refactor your existing code for easy maintenance. What you will learn Write high-quality...
The goal of this book is to teach you how to think about writing ABAP ™ software from an object-oriented point-of-view. After reading this book, you will be equipped to work with many of the new and ...
no-one-wants-to-work-on-your-infosec-team-how-to-fix-it.pdf
tv-w09-no-one-wants-to-work-on-your-infosec-team-how-to-fix-it
We are simply going to use ANSI-C to discover how object-oriented programming is done, what its techniques are, why they help us solve bigger problems, and how we harness generality and program to ...
An Object-Oriented Approach with UML, 5th Edition by Dennis, Wixom, and Tegarden captures the dynamic aspects of the field by keeping students focused on doing SAD while presenting the core set of ...
SAP ME How to Guide - Message Board
It's a good start to understand how to write mixin in Object-C. ### Import ObjCMixin ```objc #import ``` ### Define and implement a module Declare a module. ```objc @module(MyModule) @property...
The primary goal of this book is to promote object-oriented design using C# and to illustrate the use of the emerging object-oriented design patterns. Experienced object-oriented programmers find that...