CS 1102 - AY2019-T4_ Discussion Assignment.pdf - CS 1102 AY2019-T4 Discussion Assignment HOME CONTACT US RESOURCES LINKS FACULTY MY COURSES MENU CS 1102

CS 1102 - AY2019-T4_ Discussion Assignment.pdf - CS 1102...

This preview shows page 1 - 4 out of 42 pages.

6/4/2019 CS 1102 - AY2019-T4: Discussion Assignment 1/42 Home My courses CS 1102 - AY2019-T4 16 May - 22 May Discussion Forum Unit 6 Discussion Assignment Subscribe HOME CONTACT US RESOURCES LINKS FACULTY MY COURSES MENU     Search forums Discussion Assignment by Eric Goh (Instructor) - Thursday, 11 April 2019, 5:14 PM In unit 6 we are introduced to the concept of polymorphism which is derived from the Greek words poly, which means many and morpheus, which means form, structure. Discuss polymorphism in objective oriented programming and provide a java example that details the implementation of polymorphism in java objects. 48 words Permalink | Reply Re: Discussion Assignment by Phong Duong - Saturday, 18 May 2019, 12:10 PM Polymorphism is useful for code reusability. It can be used to reuse attributes and methods from a supperclass when creating subclasses. We can override and customize superclass's attributes and methods in the new subclasses based on our need. Example
Image of page 1

Subscribe to view the full document.

6/4/2019 CS 1102 - AY2019-T4: Discussion Assignment 2/42 class Human { public void smile() { System.out.println("Hi hi"); } } class John extends Human { public void smile() { System.out.println("Ha ha"); } } class Phong extends Human { public void smile() { System.out.println("Hu hu"); } } class Main { public static void main(String[] args) { Human human = new Human(); John john = new John(); Phong phong = new Phong(); human.smile(); john.smile(); phong.smile(); } } Output Hi hi Ha ha Hu hu 102 words Permalink | Show parent | Reply Re: Discussion Assignment by Dalton Overlin - Tuesday, 21 May 2019, 1:50 AM Phong. Your concise explanation was very clear on what your understanding of polymorphism is, though a few comments in your example code to show what parts of your program are considered polymorphic would have been nice. You did a good
Image of page 2
6/4/2019 CS 1102 - AY2019-T4: Discussion Assignment 3/42 job of demonstrating polymorphism with your description, and your example code is indeed a program that does utilize aspects of polymorphism, so well done. 64 words Permalink | Show parent | Reply Re: Discussion Assignment by Vinka Gracin - Wednesday, 22 May 2019, 4:11 PM Dear Phong Duong, Thank you for your post. You have provided us with simple and clear descriptions and examples that are following you writings. Keep up the good job. 29 words Permalink | Show parent | Reply Re: Discussion Assignment by Mark Rajour Nfon - Thursday, 23 May 2019, 2:39 AM Hello Phong Looking at your response I would say that it was very informative and lucrative, though your de±nition of Polymorphism was very short and simple to understand, the examples you provided really gave a clear concepts of polymorphism as used in object oriented programming. I like the examples for it made me better understand polymorphism but it is advisable to always provided enough material next time so that without an example someone will better understand the concept of polymorphism.
Image of page 3

Subscribe to view the full document.

Image of page 4
  • Fall '18

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Ask Expert Tutors You can ask You can ask ( soon) You can ask (will expire )
Answers in as fast as 15 minutes