OOP.s Assignment Part A

OOP.s Assignment Part A - Organization (o) Organization...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
Organization Department Employee Has-A Has-A Organization (o) Department (d) Employee (e1) Employee (e2) Employee (e3) OOP’s Assignment Part A Bank Account Introduction: The bank account program uses the features of OOPs using C++ to simulate a bank account. The user enters his/her username and password to view the details of the accounts he holds in a bank. And he/she is also has a facility to check their personal and contact details. Features of OOPs used in the Programming: The following features of the OOPs have been implemented in the programming: - Class Constructors Destructors Public, private access specifiers Member data and member functions Copy constructor Assignment operator - Objects - Using new and delete keywords. - Additionally this also uses the concepts of file manipulations using “fstream” library file, pointers, reference variables. - Aggregation and composition. Constructor : In C++ constructor are special member functions of a class and has the same name as the class name. Example: class HARSHA { public: HARSHA(); // constructor for class HARSHA }; A constructor cannot be declared as virtual or static, or const, or const volatile. You do not specify a return type for a constructor. A return statement in the body of a constructor cannot have a return value. Destructors: Destructors are mainly used to deallocate and also cleans up class objects and its class members when the object is destroyed. A destructor is a member function with the same name as its class prefixed by a ~ (tilde). Example: class HARSHA { public:
Background image of page 1

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

View Full DocumentRight Arrow Icon
// Constructor for class HARSHA HARSHA(); // Destructor for class HARSHA ~HARSHA(); }; To use the destructors there are two restrictions: A destructors address cannot be taken. Base class’s destructors cannot be inherit by the derived classes. Access Specifiers: An access specifier is a word that controls where the data members in a class can be accessed. Syntax: Class className { classMember accessSpecifier: classMembers }; Three main types of access specifiers in C++ programming language: Private Public Protected Private is used within the class, Public is used outside the class and A protected access specifier is a stage between private and public access Data Members: As we declare the characters integers or variables in program data members are also defined along with them except for the explicit initializes not being allowed with in class
Background image of page 2
definition. The main role of a data member in a class is to take the argument for the class and a return type for the class. Member Functions : A class definition contains the data members and member function that define the class’s attributes and behaviours, respectively. A member function requires one or more parameters to represent additional data which is required to perform a particular task. A member function is called by following the object name with a dot operator (.) Resources used: Four classes have been used to simulate this application. Below are the details of the
Background image of page 3

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

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/22/2011 for the course CS 541 taught by Professor Dr.marcosrodrigues during the Spring '09 term at SUNY Buffalo.

Page1 / 23

OOP.s Assignment Part A - Organization (o) Organization...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online