iOS two secondary development (SWIFT) class

Source: Internet
Author: User

A preliminary study of class

classperson{var firstname:string var lastname:string init (firstname:string, lastname:string) {Self.fir Stname=firstName Self.lastname=LastName} func out()String {returnSelf.firstname +Self.lastname} func goeast () {self.firstname+="AAA"}}let Person= Person (firstName:"1", LastName:"2") person. out() Person.firstname="3"; let Person2=personperson2.goeast () person2. out() person= = = Person2/*referencing the same piece of address*/structlocation{var x=0.0var y=0.0func out()Float {returnFloat (x +y); }    }//The value type method changes itself to declare the keyword mutating//Structural Bodystructlocation2{var x=0var y=0mutating func goeast () {self.x+=1    }}//Enumerationenumswitch{ Case on CaseOff mutating func click () {SwitchSelf { Case . On:self= . Off Case . Off:self= . on}}}var button=Switch.Offbutton.click ()

iOS two development (Swift) class

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.