Assignment 1 Front Sheet: Qualification BTEC Level 5 HND Diploma in Computing Unit Number and Title Submission Date
Assignment 1 Front Sheet: Qualification BTEC Level 5 HND Diploma in Computing Unit Number and Title Submission Date
Assignment 1 Front Sheet: Qualification BTEC Level 5 HND Diploma in Computing Unit Number and Title Submission Date
Student declaration
I certify that the assignment submission is entirely my own work and I fully understand the consequences of plagiarism. I understand that
making a false declaration is a form of malpractice.
Grading grid
P1 P2 M1 M2 D1 D2
❒ Summative Feedback: ❒ Resubmission Feedback:
1, Introduction
This report will review basic concepts of Object-Oriented Programing (OOP) base on a scenario. Some concepts, basic knowledge and scenarios
about design pattern will also mentioned
2, OOP General Concepts
Object-Oriented Programming (OOP) stands for Object-Oriented Programming. Inheritance, hiding, polymorphism, and other real-world
principles are all part of object-oriented programming. The main purpose of OOP is to link data and the functions that run on it so that no other
part of the code can access it except that function
The basic unit of OOP is a class, which encapsulates both the static attributes and dynamic behaviors within a "box", and specifies the
public interface for using these boxes. Since the class is well-encapsulated (compared with the function), it is easier to reuse these
classes. In other words, OOP combines the data structures and algorithms of a software entity inside the same box
OOP languages permit higher level of abstraction for solving real-life problems. The traditional procedural language (such as C and
Pascal) forces you to think in terms of the structure of the computer (e.g. memory bits and bytes, array, decision, loop) rather than
thinking in terms of the problem you are trying to solve. The OOP languages (such as Java, C++, C#) let you think in the problem space,
and use software objects to represent and abstract entities of the problem space to solve the problem.
Consider OOP as a car, there may be many cars with different names and brand but all of them will share some common properties like all of
them will have 4 wheels, Speed Limit, Mileage range etc. So here, Car is the class and wheels, speed limits, mileage are their properties.
Classes are special kinds of templates from which you can create objects. Each object contains data and methods to manipulate and access that
data. The class defines the data and the functionality that each object of that class can contain.
A class declaration consists of a class header and body. The class header includes attributes, modifiers, and the class keyword. The class body
encapsulates the members of the class, that are the data members and member functions..
3.3.2, Object
An Object is an identifiable entity with some characteristics and behavior. An Object is an instance of a Class. When a class is defined, no
memory is allocated but when it is instantiated (i.e. an object is created) memory is allocated
3.3.3, Encapsulation
Encapsulation is the process of encapsulating data and information into a single unit. Encapsulation is defined as the binding of data and the
functions that manipulate it in Object-Oriented Programming:
Public: All of the class members, data members and member functions that have been made public will be accessible. To access the
public members of a class from anywhere in the program, use the direct member access operator with the object of that class.
Protected: Protected access modifier is similar to that of private access modifiers, the difference is that the class member declared as
Protected are inaccessible outside the class but they can be accessed by any subclass(derived class) of that class.
Private: The private members of the class can only be accessed by functions within the class. Any object or function can't access them
directly
from outside the class. Only member functions and friend functions have access to a class's private data members.
3.3.4, Inheritance
Inheritance is the process by which one object can acquire the properties of another object. Inheritance is a "is a kind of" relationship and it
supports the concept of classification in which an object needs only define those qualities that make it unique within the class. Inheritance
involves a base class and a derived class. The derived class inherits from the base class and also can override inherited members as well as add
new members to extend the base class.
Classes can inherit from a single class and one or more interfaces. When inheriting from a class, the derived class inherits the members including
the code of the base class. The important point to remember is that Constructors and Destructors are not inherited from the base class.
3.3.5, Polymophism
The word polymorphism means having many forms. In simple words, we can define polymorphism as the ability of a message to be displayed
A person at the same time can have different characteristic. Like a man at the same time is a father, a husband, an employee. So the same
An operation may exhibit different behaviors in different instances. The behavior depends upon the types of data used in the operation
4, Design Patterns
4.1, Creational Design Pattern