i write the following code, but why the compiler doesn't show warning or error?
const computer* const activeComputer = [self.setting getActiveComputer];
activeComputer.name = [service name];
activeComputer.ipAddr = ipAddress;
declaration of getActiveComputer function
- (const computer* const) getActiveComputer
Dot notation in objective-C is short-hand for calling an objects getter/setter methods. What you have would be equivalent to:
[activeComputer setName:[service name]];
I would think that calling a method would not violate the const declaration so there is no warning.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.