Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Syntax for multiple protocols

Tags:

objective-c

What is the Objective-C syntax for multiple protocols?

like image 847
some_id Avatar asked Feb 18 '11 19:02

some_id


People also ask

What are protocols in C?

Objective-C allows you to define protocols, which declare the methods expected to be used for a particular situation. This chapter describes the syntax to define a formal protocol, and explains how to mark a class interface as conforming to a protocol, which means that the class must implement the required methods.

How do you use protocols?

Protocol is used to specify particular class type property or instance property. It just specifies the type or instance property alone rather than specifying whether it is a stored or computed property. Also, it is used to specify whether the property is 'gettable' or 'settable'.

What is protocol in Swift with example?

A protocol defines a blueprint of methods, properties, and other requirements that suit a particular task or piece of functionality. The protocol can then be adopted by a class, structure, or enumeration to provide an actual implementation of those requirements.


1 Answers

Could you please elaborate on your question? Otherwise this is the proper way to declare a class that conforms to multiple protocols. You specify the protocols a class conforms to after the superclass declaration in a classes header file.

@interface MyClass : MySuperClass <Delegate1, Delegate2, Delegate3> {
     //instance variables
}

//properties

//methods
like image 82
Convolution Avatar answered Nov 17 '22 21:11

Convolution