- mohammadhuzaifabinazmal
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class BankAccount{ | |
| let accountNumber : Int | |
| let rountingCode = 12345678 | |
| var blance : Double | |
| class var interestRate : Float{ | |
| return 2.0 | |
| } | |
| init(number : Int, initialBalance : Double){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Person{ | |
| // stored properties | |
| var firstName : String | |
| var lastName : String | |
| // computed property | |
| var fullName : String{ | |
| return firstName + " " + lastName // return the computed property |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //http://stackoverflow.com/questions/24021093/error-in-swift-class-property-not-initialized-at-super-init-call | |
| // | |
| class SuperClass { | |
| var state : String | |
| var old : Int | |
| var income : Double | |
| func SuperClassInfo(){ | |
| print("this is \(state), the state is \(old) years older. and anual incoming is \(income) billion") | |
| } | |
| init(){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import UIKit | |
| // a simple class | |
| class State{ | |
| var region = " " | |
| var population = 0 | |
| var gdp = 0.0 | |
| func stateInfo(){ | |
| print("the State Name is \(region),here has more than \(population) milion people and in recent year they earn \(gdp)% GDP") | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var myClosure = { print("this is a simple closure")} | |
| func myClosureFuncton( closureParamiter : ()->() ){ | |
| for _ in 1...5{ | |
| closureParamiter() | |
| } | |
| } | |
| myClosureFuncton(myClosure) | |
| // more shortly |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // enumeration of plane seat book | |
| enum PlaneSeat{ | |
| case window,middle,aisle,freeSeat | |
| } | |
| /* var select : PlaneSeat | |
| select = .aisle */ | |
| var select = PlaneSeat.aisle | |
| switch select{ | |
| case .window : |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var temperature : Int? | |
| print("Today temperature is \(temperature)") | |
| //prints "Today temperature is nil" | |
| // optional with dictionary | |
| var myDictionary = ["cn":"China","uk":"England","bd":"Bangladesh"] | |
| if var state = myDictionary ["bd"]{ | |
| print(state) | |
| }else{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| https://azmaltech.wordpress.com/ | |
| https://bd.linkedin.com/in/azmaltech | |
| https://www.facebook.com/azmaltech |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #define size 50 | |
| struct azmalOne{ | |
| char firstName[size]; | |
| char lastName[size]; | |
| char color[size]; | |
| int age; | |
| float height; | |
| float weight; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #define size 50 | |
| struct azmalOne{ | |
| char firstName[size]; | |
| char lastName[size]; | |
| char color[size]; | |
| int age; | |
| float height; | |
| float weight; |