Polymorphism in OOP - Kotlin

  Рет қаралды 4,122

Neat Roots

Neat Roots

Күн бұрын

Пікірлер: 10
@sidharthsharma7897
@sidharthsharma7897 5 ай бұрын
//Two types of Polymorphism in kotlin ->Static and Dynamic open class A{ fun hello1(){ println("Hii from the base class") } fun sum(a:Int,b:Int):Int{ hello1() return a+b } } class B:A(){ fun hello(){ println("Hii form the sub class") } fun sum(a:Int,b:Int,c:Int):Int{ //Function overloading //Dynamic Polymorphism(Run time binding) hello() return a+b+c } } fun main() { val obj=B() val result=obj.sum(12,32,4) println(result) } ////Polymorphism Static or compile time polymorphism //open class Father { //we have to open a class for inheritance //Base class // open val car="Bmw" ////We have to open the variable we are overriding in the parent class //// fun carName(){ //// println("Father has a $car car.") //// } //} // //class child: Father() { //sub class // override val car="Audi" // //we have to override the variable of same name in the child class // fun carName(){ // println("Child has a $car car.") // println("Father has a ${super.car}.") // //we use super for accessing the variable in parent class // // with the same name as in the child class // } //} //fun main() { // val obj1=child() // obj1.carName() //// println(obj1.car) //} Am i correct?? Please respond
@sidharthsharma7897
@sidharthsharma7897 5 ай бұрын
why do we get the answer from the class we have made object from, when the function name is same in both the classes in function overloading?
@Jawad_Ahmad_01
@Jawad_Ahmad_01 Жыл бұрын
method overloading is dynamic or static ??? (at 1.57 minute of this video)
@rishikesh4498
@rishikesh4498 Жыл бұрын
Compile/Static poly = Method overloading run/Dynamic poly = Method overriding
@Exp-e6c
@Exp-e6c Жыл бұрын
Function app hi batay hay lekin function me khi vhi overloading ke bare me nhi batay hay aap
@dishaswarajsoft2834
@dishaswarajsoft2834 Жыл бұрын
Good
@DhruvahDev
@DhruvahDev 7 ай бұрын
Nice tutorial!
@NeatRoots
@NeatRoots 7 ай бұрын
Thanks!
@STARSOULEDITS
@STARSOULEDITS 10 ай бұрын
ye banda sadharan concept ko bhi muskil kr de rha h
@STARSOULEDITS
@STARSOULEDITS 10 ай бұрын
codes me phle khud confirm ho ja bhai tb padhane baith jana :(
Encapsulation in Kotlin
14:28
Neat Roots
Рет қаралды 4,9 М.
🔥Polymorphism in detail with Example in Hindi
20:44
Learn Code With Durgesh
Рет қаралды 96 М.
She wanted to set me up #shorts by Tsuriki Show
0:56
Tsuriki Show
Рет қаралды 8 МЛН
Counter-Strike 2 - Новый кс. Cтарый я
13:10
Marmok
Рет қаралды 2,8 МЛН
Почему Катар богатый? #shorts
0:45
Послезавтра
Рет қаралды 2 МЛН
Constructor in Kotlin - OOP in Kotlin
16:44
Neat Roots
Рет қаралды 4,7 М.
Object Oriented Programming (OOP) in C++ Course
1:30:26
freeCodeCamp.org
Рет қаралды 2,6 МЛН
I Helped 2,000 People Walk Again
15:31
MrBeast
Рет қаралды 12 МЛН
Learn Kotlin in 12 Minutes
12:01
Rahul Pandey
Рет қаралды 347 М.
Intro to Object Oriented Programming - Crash Course
30:18
freeCodeCamp.org
Рет қаралды 990 М.
Kotlin Inheritance Tutorial - Inheritance with Example
9:40
Simplified Coding
Рет қаралды 11 М.
Kotlin Abstract Class Tutorial with Example
13:02
Simplified Coding
Рет қаралды 11 М.