| |
| Recipe 3.2: Declaring a Class as an Interface |
Last Updated: Sep 8, 2003
Status: Likely
|
|
|
|
How important is this problem to you?
(Login to Vote)
5.00 Rating, 2 Votes
|
|
How acceptable is the proposed solution?
(Login to Vote)
5.00 Rating, 1 Vote
|
|
Problem:
   
You want to declare that an entire class represents a single structured interface; that is, that the class is an interface class.
Solution:
   
Use the is interface property on the class:
class MyClass is interface {
method foo { ... };
method bar { ... };
}
Discussion:
The is interface property, when used on a class, is simply a shorthand way to mark that all public methods declared within the class are interface methods. This is especially useful in declaring abstract classes as in the previous recipe. (You're specifying how the class behaves, but not the implementation details of how it does it.)
Issue:
Any point in this including private methods, too? Are private methods, by definition, of fixed interface?
|
|