smali

суббота, 1 октября 2016 г.

Inheritance and polymorphism -> examples



Inheritance
https://gist.github.com/MykolaBova/7c53b2bad0ee834e3148480c1f5a94b0

Override
https://gist.github.com/MykolaBova/663e45b04baff0d281ca06ccc7c186da

Hide Instance Variable
https://gist.github.com/MykolaBova/ae88bc20ea199d2d545d0a05d5580ca3





toString
https://gist.github.com/MykolaBova/47c206aa1dfc5e00d9c5d89ce447ed4d

toString2
https://gist.github.com/MykolaBova/8a2bfc7bf78808e06ca64a8a5211c769

Equals
https://gist.github.com/MykolaBova/1ce837557255ea30369698498ab9d942

<<
It is reflexive: x.equals(x) should return true.

It is symmetric: x.equals(y) return true => y.equals(x) returns true.

It is transitive: x.equals(y) returns true and y.equals(z) returns true => x.equals(z) return true.

It is consistent: multiple invocations of x.equals(y) consistently return true (or false)

x.equals(null) should return false.
>>

Equals2
https://gist.github.com/MykolaBova/5a7e9cf69e321f522eee36b940276aa9

Hash
https://gist.github.com/MykolaBova/478234fbf2d20557897d3ec334f7e2cd

Hash2
https://gist.github.com/MykolaBova/f6477d03b4d161a762f244d5d8cdf3eb

<<
This method is supported for the benefit of hash tables such as those provided by HashMap.

On the same object more than once during an execution of a Java application,
the hashCode method must consistently return the same integer

If two objects are equal according to the equals(Object) method,
then calling the hashCode method on each of the two objects must produce the same integer result.

producing distinct integer results for unequal objects may improve the performance of hash tables.
>>

Super
https://gist.github.com/MykolaBova/22335dacb81f954a68dc6e23e070470e

Super2
https://gist.github.com/MykolaBova/2edf6ad6c8f189b71a4f67f435ad63c9

Covariant
https://gist.github.com/MykolaBova/324a606cc917d377c79f763f3cfea406

Binding
https://gist.github.com/MykolaBova/d0579475f81e512a2aa1ae331223da60

Late binding
https://gist.github.com/MykolaBova/fef92bc3936caac4e7cb7ece824db273

Cast
https://gist.github.com/MykolaBova/5083489cd0c96f433fdd163ea237c262

Instanceof
https://gist.github.com/MykolaBova/f0f752f491ddc55f3e4326df105ec230

Clone
https://gist.github.com/MykolaBova/29994a2d151993d9dde91cba9a68d4d2

<<
final
Class - no subclass
method - no override
>>

<<
protected = default + protected
>>

Protected
https://gist.github.com/MykolaBova/6d81358bff92b5397a015406c33de300


Комментариев нет:

Отправить комментарий