{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

lecture-3 - Instantiation in Inheritance Developer is one...

Info icon This preview shows pages 1–10. Sign up to view the full content.

View Full Document Right Arrow Icon
Object Oriented Programming - Introduction R.B. Lenin Winter 2006 DA-IICT 29 Instantiation in Inheritance Developer is one category of employee and Manager is another Neither of these categories can be used to identify an individual and they are just templates John ” is an example of a developer and hence an instance of a particular class of things known as developers
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Object Oriented Programming - Introduction R.B. Lenin Winter 2006 DA-IICT 30 Inheritance of Common Information All people have a name and all employees have a nominated department whether they are permanent or temporary In turn all classes below Employee inherit the concept of a department “John” belongs to the department “ Payroll
Image of page 2
Object Oriented Programming - Introduction R.B. Lenin Winter 2006 DA-IICT 31 Abstract Classes in Inheritance The example defines a number of classes Employee Permanent Employee Temporary Employee of which we have no intention of making an example These are termed as abstract classes and are intended as placeholders for common features
Image of page 3

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Object Oriented Programming - Introduction R.B. Lenin Winter 2006 DA-IICT 32 Inheritance of Defaults In the example, Permanent Employees earn a default salary of £14,000 a year It does not mean that all types of employee have that default. Managers have a default of £30,000 Therefore a class can overwrite the defaults defined in one of its parents
Image of page 4
Object Oriented Programming - Introduction R.B. Lenin Winter 2006 DA-IICT 33 Single Inheritance If a class inherits from only one other class, it is called single inheritance All OOP languages support single inheritance
Image of page 5

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Object Oriented Programming - Introduction R.B. Lenin Winter 2006 DA-IICT 34 Multiple Inheritance If a class inherits from more than one other classes, it is called multiple inheritance Not all OOP languages support multiple inheritance Java does not support multiple inheritance but C++
Image of page 6
Object Oriented Programming - Introduction R.B. Lenin Winter 2006 DA-IICT 35 Basic Principles of OOP Encapsulation Inheritance Polymorphism
Image of page 7

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Object Oriented Programming - Introduction R.B. Lenin Winter 2006 DA-IICT 36 Polymorphism This word is derived from the Greek word “Polymorphos” means “having many forms” A dog’s sense of smell is polymorphic if it smells a cat, it will bark and run after it if it smells food, it will salivate and run to it The difference is what is being smelled: the type of data being operated upon the dog’s nose
Image of page 8
Object Oriented Programming - Introduction R.B. Lenin Winter 2006 DA-IICT 37 Polymorphism
Image of page 9

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 10
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

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