Page 140

Swift

println(mark2) println(mark3) When we run the above program using playground, we get the following result: swift 98 89 76 Class with classname StudDetails are defined as a base class here which is used to contain students name, and three subjects mark as mark1, mark2 and mark3. 'let' keyword is used to initialize the value for the base class and base class value is displayed in the playground with the help of 'println' function.

Subclass The act of basing a new class on an existing class is defined as 'Subclass'. The subclass inherits the properties, methods and functions of its base class. To define a subclass ':' is used before the base class name class StudDetails { var mark1: Int; var mark2: Int;

init(stm1:Int, results stm2:Int) { mark1 = stm1; mark2 = stm2; }

func print() { println("Mark1:\(mark1), Mark2:\(mark2)") } }

class display : StudDetails { 128

​Fast is really a strong and intuitive coding language for macOS, iOS, watchOS and tvOS....  

Quick is a effective and instinctive programming language for macOS, iOS, watchOS and tvOS....

Read more
Read more
Similar to
Popular now
Just for you