Jump to content

Object serialization: Difference between revisions

m
(Omitted Mathematica)
Line 1,132:
{
if ((self = [super init])) {
animalName = [name retain];
numberOfLegs = legs;
}
Line 1,147:
[coder encodeInt: numberOfLegs forKey: @"Animal.legs"];
}
- (idinstancetype) initWithCoder: (NSCoder*)coder
{
if ((self = [super init])) {
animalName = [[coder decodeObjectForKey: @"Animal.name"] retain];
numberOfLegs = [coder decodeIntForKey: @"Animal.legs"];
}
Line 1,203:
[coder encodeObject: eatenList forKey: @"Mammal.eaten"];
}
- (idinstancetype) initWithCoder: (NSCoder*)coder
{
if ((self = [super initWithCoder: coder])) {
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.