19
Reply

How can achieve polymorphism without using overloading and overriding?

Dharmendra Singh

Dharmendra Singh

11y
6.4k
1
Reply

    We can implement polymorphism using generic types and params keyword in method signature.

    by the use of new keyword in method hiding

    @Durga Velusamy. You stated "by inheritance". If we go by inheritance then it is precisely the overriding (virtual/override). Here question is can we achieve the same without using overloading and overriding.

    @Shilpa Kuber. You rightly stated that "You can achieve polymorphism by creating an interface and implementing that interface in two classes with different implementation." but that is precisely the overloading. Here question is can we achieve the same without using overloading and overriding.

    @Miroslav Bucko, Polymorphism applies to overriding and overloading both. overriding is called as run time polymorphism whereas overloading is called as compile time polymorphism.

    @Durga Velusamy, @Dharmendra Singh. Whats the purpose of posting duplicate statements?

    through inheritance

    You can also achieve polymorphism using templates , generic

    by inheritance

    by inheritance

    You can achieve polymorphism by creating an interface and implementing that interface in two classes with different implementation.

    Polymorphism means 'one thing many form'. Yes we can achieve polymorphism without overloading and overriding.

    Polymorphism means 'one thing many form'. Yes we can achieve polymorphism without overloading and overriding.

    Polymorphism means 'one thing many form'. Yes we can achieve polymorphism without overloading and overriding.

    Polymorphism means 'one thing many form'. Yes we can achieve polymorphism without overloading and overriding.

    Polymorphism means 'one thing many form'. Yes we can achieve polymorphism without overloading and overriding.

    Polymorphism means 'one thing many form'. Yes we can achieve polymorphism without overloading and overriding.

    Polymorphism means 'one thing many form'. Yes we can achieve polymorphism without overloading and overriding.

    Polymorphism applies to overriding not overloading