objective c - Call instance method from class method -
So I need to call some example methods in class methods in objecitve-c ...
< P> Example: + (ID) Barwithfu: (NSF *) {[Fu Foo]; // compiler raises the warning} - (zero) foo {// cool stuff}
then my question; StackOverFlow is how do you do such things in purpose, I'm doing the OO in a new way, am I crazy, or is there a way to do this?
There is no way to do this. It does not work with object-orientation.
Classes type is just about things They just describe what does that kind of thing?
An example might be that you have a 'dog' class. You have examples of ways that will define how a dog loses its tail or how it eats you. There may be a class method to do.
My pet dog Fido Class is an example of a dog. I can send a fido message, asking him to remove his tail and eat his food. However, I can not ask the class 'dog' to reduce my tail; Whose tail wag? Is this a fido, or would it be my neighbor's dog?
When you send a message in class, you do not have to work with a 'self' variable. There is nothing that can bend itself to the tail. Class messages are used to create examples of most classes or to get on other general information.
Edit: To clarify, this final paragraph is a simplification, there is a 'self' variable in class methods because the description of BBM - this is the description of the class of computer Is the context. He said, I do not think there was an opportunity to use 'self' in a class system at any time.
Comments
Post a Comment