You are on page 1of 2

[OBJECTIVE-C – LAB1

]

MobiPro.VN

Ex1.
Which of the following are invalid names? Why? Int _calloc clearScreen ReInitialize _ Xx _1312 A$ playNextSong 6_05 alphaBetaRoutine z

Ex2.
Imagine that you owned a boat and a motorcycle in addition to a car. List the actions you would perform with each of these. Do you have any overlap between these actions?

Ex3.
Based on question 2, imagine that you had a class called Vehicle and an object called myVehicle that could be either Car, Motorcycle, or Boat. Imagine that you wrote the following: [myVehicle prep]; [myVehicle getGas]; [myVehicle service]; Do you see any advantages of being able to apply an action to an object that could be from one of several classes?

Ex4.
Create a class Dog inheritance from NSObject class. Dog have some properties and method as the following: Property     Name Age Type Size (kích cỡ kiểu số nguyên)

Method   Voice (hiển thị gâu gâu lên màn hình) Eat (Mỗi khi được ăn, chó sẽ tang kích thước (size) lên 1 đơn vị)

MOBIPRO – Mobile Your Life !

Page 1

[OBJECTIVE-C – LAB1]  Display (Hiển thi thông tin của chó). Input property values and call methods of Dog in the main function. MobiPro.vn/objc/ MOBIPRO – Mobile Your Life ! Page 2 . Create an instance of Dog. WEBSITE http://mobipro.VN Ex5.