Preview

Oop Inheritance

Powerful Essays
Open Document
Open Document
914 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
Oop Inheritance
MTS 6014
ADVANCE PROGRAMMING

GROUP PROJECT

PROGRAMMING
INHERITANCE

PREPARED FOR :
DR. NOR HASBIAH BINTI UBAIDULLAH

PREPARED BY: MARAN CHANTHIRAN M20121000841 MUSTAKIM BIN BAHARUDIN M20121000839 SHARIMAN HAFIZAN BIN SHAMSUDIN M20112001355

Tugasan 1
Sebagai seorang guru yang mengajar pengaturcaraan berorientasi objek, anda perlu menerangkan salah satu konsep penting dalam OOP iaitu pewarisan kepada pelajar dalam kelas anda. Penerangan anda perlu jelas agar ia mudah difahami oleh pelajar. Sehubungan itu anda dikehendaki menyertakan contoh pewarisan yang bersesuaian dalam penerangan anda dan sertakan gambarajah sekiranya ia membantu penerangan anda. Seterusnya terangkan apakah kebaikan pewarisan dalam pengkodan aturcara kepada pelajar anda.

INHERITANCE

1.0 INTRODUCTION

Inheritance is a relation given to the classes in a program. A class can acquire the other class members. Inherited members are available for a class's use as though they were defined in the same class. Inheritance occurs when one class is derived from another. The strength of inheritance is to reuse the existing class and modify the existing class to a new class. Reusing the existing code minimizes the re-occurrences of instructions in a program. This unit introduces you to the inheritance feature of OOP.

Inheritance is the capability by which the objects of one class inherit the members of the objects in another class.

Consider class1 and class2. Class1 is used to derive/create class2. Class1 is called the base class and class2 is called the derived class.

To understand inheritance, consider the following example.

Figure 1:Example for Inheritance

In the Figure 1, the class Automobile can be classified into

Car class Bus class

In the example, Automobile is the base class. Car and Bus are called derived classes and belong to the base class Automobile. They share common characteristics and functions. For

You May Also Find These Documents Helpful

  • Powerful Essays

    d. Ontogenetic explanation- describes how a structure or behavior develops including the influence of genes, nutrition, experiences, and their interactions.…

    • 3216 Words
    • 13 Pages
    Powerful Essays
  • Satisfactory Essays

    Dna Worksheet Sci/230

    • 314 Words
    • 2 Pages

    passed on to the organisms from its parents. The phenotype is the process of determining which…

    • 314 Words
    • 2 Pages
    Satisfactory Essays
  • Satisfactory Essays

    biology

    • 361 Words
    • 2 Pages

    -Polygenic inheritance is the additive effects of two or more genes on a single phenotypic characteristic.…

    • 361 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    9. A method that stores a value in a class’s field or in some other way changes the value of a field is known as a…

    • 1518 Words
    • 7 Pages
    Good Essays
  • Better Essays

    DNA- The substance of genes. The units of inheritance that transmit information from parents to offspring.…

    • 3353 Words
    • 14 Pages
    Better Essays
  • Good Essays

    Nine Properties of Life

    • 426 Words
    • 2 Pages

    The nine properties of life are as follows, Order, Metabolism, Motility, Responsiveness, Reproduction, Development, Heredity, Evolution and Adaptations. To understand what each of these properties are and their role in life, each characteristic will be discussed. First, Order is defined as a precise arrangement of units and activities structured together. Second, Metabolism is the chemical reaction that is a acquired usage to repair, grow and other survival processes.…

    • 426 Words
    • 2 Pages
    Good Essays
  • Satisfactory Essays

    6 8c Chapter Excercises

    • 515 Words
    • 2 Pages

    Polymorphism is the concept that a message gives different meanings to different objects. For example GOOD NIGHT message might produce different results depending if it is received by a child or the family dog. When received by the parent object the message causes the parent object to read a bedtime story. When received by the dog object it causes the dog to go to sleep and when received by the child object it causes the child to get ready for bed.…

    • 515 Words
    • 2 Pages
    Satisfactory Essays
  • Satisfactory Essays

    Quiz 1

    • 1017 Words
    • 5 Pages

    | The totality of a group's thought, experiences, and patterns of behavior transmitted over the course of generations is part of the definition of:…

    • 1017 Words
    • 5 Pages
    Satisfactory Essays
  • Satisfactory Essays

    a person or thing from which a person, animal, or plant is descended or originates; an ancestor or parent.…

    • 301 Words
    • 2 Pages
    Satisfactory Essays
  • Satisfactory Essays

    Attribute-Based Programming: Attributes assist you to add declarative information in your programs. This information can then be queried at runtime using reflection.…

    • 485 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    Pedigree lab

    • 1244 Words
    • 5 Pages

    When we started this lab the question (subject) we had to try and solve was ‘Which pattern of inheritance…

    • 1244 Words
    • 5 Pages
    Good Essays
  • Satisfactory Essays

    Java Programming I Exam

    • 912 Words
    • 4 Pages

    Locating and repairing all syntax errors is part of the process of ____ a program.…

    • 912 Words
    • 4 Pages
    Satisfactory Essays
  • Good Essays

    Mendel was the first to see that traits in each person were passed down, not just from the parents, but also from grandparents, great-grandparents, great-great-grandparents, etc. He also figured out that not every person is the same as his or her own parents. Some of these traits can come from other family members that are no longer living. Mendel is the first to also describe these traits as passages through the generations. There are at least three reasons for Mendel’s success; 1) He focused on just a few traits – seven to be exact – instead of many traits as others did; 2) he thoroughly documented and quantified all of his experimental results; and 3) he chose to study these traits in the garden pea, Pisum sativum.…

    • 474 Words
    • 2 Pages
    Good Essays
  • Good Essays

    X b. Changes that an organism acquires during its lifetime are passed to its offspring.…

    • 1171 Words
    • 5 Pages
    Good Essays
  • Satisfactory Essays

    Ant 2200 Exam I

    • 1723 Words
    • 7 Pages

    | The idea that organisms change during their lifetime and pass those changes on to their offspring is known as the theory of:Answer…

    • 1723 Words
    • 7 Pages
    Satisfactory Essays

Related Topics