Polymorphism in Object Oriented Software Engineering | OOSE | Exam Prepration

Home Forums Official Forum- Navsingh Object Oriented Software Engineering Polymorphism in Object Oriented Software Engineering | OOSE | Exam Prepration

This topic contains 0 replies, has 1 voice, and was last updated by  Nav Singh 2 years, 5 months ago.

  • Author
    Posts
  • #2924 Reply

    Nav Singh
    Keymaster

    What is Polymorphism?
    Polymorphism means many forms its the most complex among, abstraction, inheritance and encapsulation.

    Example: The “+” plus sign

    In lots of languages more specifically talking about “Java” as in first year of my BSc honours in Computing at National College of Ireland. I studied Polymorphism in Java.

    Ok, continuing with the example –

    If, we have “a+b

    and if the values provided for “a” and “b” are integers , like a=1 and b=2

    It will automatically add and we get a+b = 1+2 = 3  as result.

    but if the values are Strings it will conciliate them –

    if

    a=”Hello” and b=”World”

    Then

    a+b = HelloWorld   as result

    Thats, what polymorphism is.

     

    Another Example very specific to Java

    In, Polymorphism  for example we are Inheriting some classes from a parent class.

    Example of polymorphism _ What is Polymorphism

    Since, We know a inherited class use the behavior of the parent class.In polymorphism, for an instance think we have a bank account class with a behavior “withdraw” and a child class has  a situation that simple withdraw behavior is not sufficient.In,this case

    We @Override the default behavior and write rules for withdraw within that child class to use for just that class whenever needed.

    I hope it helped.For any questions comment below or start a topic in Navsingh Forum

    or check out the Object Oriented Software Engineering Forum

Reply To: Polymorphism in Object Oriented Software Engineering | OOSE | Exam Prepration
Your information:




Official Forum

This is the Official Forum of Navsingh a community that helps you find answers to all of your problems,they can be Java/programming,wordpress,android, android programming, seo related or technology related