Free Essay

Oop Concepts with Real Life Example and Codes

In:

Submitted By kshfse
Words 1017
Pages 5
OOPS Concept with Real-world example
Introduction

OOP is Nothing but Object Oriented Programming.According to Wikipedia, Object-oriented programming (OOP) is a programming paradigm that uses "objects" and their interactions to design applications and computer programs.

OOPs have following features

1. Object - Instance of class
2. Class - Blue print of Object
3. encapsulation - Protecting our data
4. polymorphism - Different behaviors at diff. instances
5. abstraction - Hidding our irrelavance data
6. inheritence - one property of object is aquring to another property of object

1. Object
Basically an object is anything that is identifiable as an single material item. You can see around and find many objects like Camera, Monitor, Laptop etc. In OOP perspective, an object is nothing but an instance of a class that contains real values instead of variables

2. Class

A class is a template definition of the methods and variables for a particular kind of object. In other words, class is the blue print from which an individual objects are created.

every human has eye ,so eyecolor can be considered as the property of human being which can be encapsulted as a data in our class Human class Human
{
private: EyeColor IColor; NAME personname;
};

Consider object of class of Human myhuman;

we want set myhuman's name as "linto" and IColor as "black", For that we want methods to do that task.

So need methods for class to do a particular task on the data class Human
{
private: EyeColor IColor; NAME personname; public: void SetName(NAME anyName); void SetIColor(EyeColor eyecolor);
};

3. Abstraction

Abstraction is a process of identifying the relevant qualities and behvaiors an object should possess. Lets take an example to understand abstraction. A Laptop consists of many things such as processor, motherboard, RAM, keyboard, LCD screen, wireless antena, web camera, usb ports, battery, speakers etc. To use it, you don't need to know how internally LCD screens, keyboard, web camera, battery, wireless antena, speakers works. You just need to know how to operate the laptop by switching it on. The intrinsic details are invisitble. Think about if you would have to call to the engineer who knows all internal details of the laptop before operating it. This would have highly expensive as well as not easy to use everywhere by everyone. So here the Laptop is an object that is designed to hide its complexity.

Think If you need to write a piece of software to track the students details of a school, you may probably need to create Students objects. People comes in all different backgrounds, educational qualifications, locations, hobbies, ages and have multiple religion, language but in terms of application, an student is just a name, age, class and roll number, while the other qualities are not relevant to the application. Determining what other qualities (background, qualifications, location, hobbiels etc) are in terms of this application is abstraction.

In object-oriented software, complexity is managed by using abstraction. Abstraction is a process that involves identifying the critical behavior of an object and eliminating irrelevant and complex detilals. A well thought-out abstraction is usually simple, and easy to use in the perspective of the user, the person who is using your object.

4. Encapsulation

Encapsulation is a method for protecting data from unwanted access or alteration by packaging it in an object where it is only accessible through the object's interface. Encapsulation are often referred to as information hiding. But both are different. Infact information hiding is actually the result of Encapsulation. Encapsulation makes it possible to separate an object's implementation from its orgiinal behavior - to restrict access of its internal data. This restriction facilitate certains detiails of an object;s behavior to be hidden. This allows to protect an object's interal state from corruption by its user.

It is the mechanism by which Abstraction is implemented. In other words you can say that it is the result of the Encapsulation. For example, the Laptop is an object that encapsulates many technologies/hardwares that might not be understood clearly by most people who use it.
Inheritance

5. Inheritance

Inheritance is the ability to define a new class or object that inherits the behaviour and its functionality of an existing class. The new class or object is called a child or subclass or derived class while the original class is called parent or base class. For example, in a software company Software Engineers, Sr. Software Engineers, Module Lead, Technical Lead, Project Lead, Project Manager, Program Manager, Directors all are the employees of the company but their work, perks, roles, responsibilities differs. So in OOP, the Employee base class would provide the common behaviours of all types/level of employee and also some behaviours properties that all employee must have for that company. The particular sub class or child class of the employee would implement behaviours specific to that level of the employee. So by above example you can notice that the main concept behind inheritance are extensibility and code reuse (in this case you are extending the Employee class and using its code into sub class or derived class).

6. Polymorphism

As name suggests, Polymorphism means an ability to assume different forms at different places. In OOP, it is a language's ability to handle objects differently based on their runtime type and use. Polymorphism is briefly described as "one interface, many implementations".Ppolymorphism is a characteristic of being able to assign a different meaning or usage to something in different contexts - specifically, to allow an entity such as a variable, a function, or an object to have more than one form.

There are two types of polymorphism. * Compile time polymorphism - It is achieved by overloading functions and operators * Run time polymorphism - It is achieved by overriding virtual functions
Lets say you have a class that have many Load methods having different parameters, this is called Compile time polymorphism. Lets take another example where you have a virtual method in the base class called Load with one parameter and you have redefined its functioanlity in your sub class by overriding base class Load method, this is called Run time polymorphism.

Similar Documents

Free Essay

Php for Social Solutions

...Object-Oriented Programming with PHP5 Learn to leverage PHP5's OOP features to write manageable applications with ease Hasin Hayder BIRMINGHAM - MUMBAI Object-Oriented Programming with PHP5 Copyright © 2007 Packt Publishing All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews. Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the authors, Packt Publishing, nor its dealers or distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book. Packt Publishing has endeavored to provide trademark information about all the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information. First published: December 2007 Production Reference: 1031207 Published by Packt Publishing Ltd. 32 Lincoln Road Olton Birmingham, B27 6PA, UK. ISBN 978-1-847192-56-1 www.packtpub.com Cover Image by Karl Moore (karl.moore@ukonline.co.uk) Credits Author Hasin Hayder Reviewers Kalpesh Barot Murshed Ahmed Khan Proofreader Development Editor Nanda Padmanabhan...

Words: 10232 - Pages: 41

Free Essay

Programming

...TeamLRN Robert Lafore Teach Yourself Data Structures and Algorithms in 24 Hours 201 West 103rd St., Indianapolis, Indiana, 46290 USA Sams Teach Yourself Data Structures and Algorithms in 24 Hours Copyright © 1999 by Sams Publishing All rights reserved. No part of this book shall be reproduced, stored in a retrieval system, or transmitted by any means, electronic, mechanical, photocopying, recording, or otherwise, without written permission from the publisher. No patent liability is assumed with respect to the use of the information contained herein. Although every precaution has been taken in the preparation of this book, the publisher and author assume no responsibility for errors or omissions. Neither is any liability assumed for damages resulting from the use of the information contained herein. International Standard Book Number: 0-672-31633-1 Library of Congress Catalog Card Number: 98-83221 Printed in the United States of America First Printing: May 1999 01 00 99 4 3 2 1 EXECUTIVE EDITOR Brian Gill DEVELOPMENT EDITOR Jeff Durham MANAGING EDITOR Jodi Jensen PROJECT EDITOR Tonya Simpson COPY EDITOR Mike Henry INDEXER Larry Sweazy PROOFREADERS Mona Brown Jill Mazurczyk TECHNICAL EDITOR Richard Wright Trademarks All terms mentioned in this book that are known to be trademarks or service marks have been appropriately capitalized. Sams Publishing cannot attest to the accuracy of this information. Use of a term in this...

Words: 10065 - Pages: 41

Premium Essay

It-10

...Macintosh which is produced by Apple and Windows based which dominates all others. 3) Needs assessment- A Commander from a support unit ask you, "Is it possible for ten personnel sitting at ten different workstations to have the ability to print to one printer?" The answer is yes. Provided that all users are connected to the internet server; if so all you would have to do is network the printer. Next you need to decide whether or not you want to perform the task on site or from a remote location. For this example I will work from a remote location. I would need the network IP address, and the computer names for all of the workstations that need access to the printer. After I have that information I would have to connect the printer to a workstation and add it to the network to establish a printer name. Once I have done that then I can add that printer to all of the other workstations giving all users access to that printer. This is an example of an...

Words: 1538 - Pages: 7

Free Essay

Somewhat Student

...the methodology look like? Draw a picture (similar to those in Figures 1–2 through 1–7). How would this new methodology compare to the others? A: Attached on end of this Module. C. Look on the web for different kinds of job opportunities that are available for people who want analyst positions? Compare and contrast the skills that the ads ask for to the skills that we presented in this chapter. A: The skills required for analyst on the web included ability to write up report, make data entries, MS office, project, access experience, ability to look at data as a “big picture”, good soft skills, ability to see trends in data. The skills represented in this chapter focus more on ideas like methodology and knowing SDLC. We think in the real world, companies...

Words: 890 - Pages: 4

Premium Essay

C++ Programming

...C++ PROGRAMMING: FROM PROBLEM ANALYSIS TO PROGRAM DESIGN FIFTH EDITION D.S. MALIK Australia  Brazil  Japan  Korea  Mexico  Singapore  Spain  United Kingdom  United States C++ Programming: From Problem Analysis to Program Design, Fifth Edition D.S. Malik Executive Editor: Marie Lee Acquisitions Editor: Amy Jollymore Senior Product Manager: Alyssa Pratt Editorial Assistant: Zina Kresin Content Project Manager: Matthew Hutchinson Art Director: Faith Brosnan Print Buyer: Julio Esperas Cover Designer: Roycroft Design/ www.roycroftdesign.com Cover Photo: ª Guntmar Fritz/Masterfile Proofreader: Green Pen QA Indexer: Elizabeth Cunningham Compositor: Integra ª 2011 Course Technology, Cengage Learning ALL RIGHTS RESERVED. No part of this work covered by the copyright herein may be reproduced, transmitted, stored or used in any form or by any means graphic, electronic, or mechanical, including but not limited to photocopying, recording, scanning, digitizing, taping, Web distribution, information networks, or information storage and retrieval systems, except as permitted under Section 107 or 108 of the 1976 United States Copyright Act, without the prior written permission of the publisher. For product information and technology assistance, contact us at Cengage Learning Customer & Sales Support, 1-800-354-9706 For permission to use material from this text or product, submit all requests online at www.cengage.com/permissions Further permissions questions can be...

Words: 11776 - Pages: 48

Premium Essay

Saylor

...[Note: This document has been modified from the original by the Saylor Foundation] Introduction to Software History by Cornelis Robat, Editor First Steps This part will be different from the History of the computer, no chronological travel through software-land, but a collection of articles and assays on software. Software has a long history and as far as the facts are known to us we will give them to you. When missing stories, data, or other information are shared to us they will be put on this site. If you have any comments of suggestions regarding this page or any other page please do not hesitate to contact us. A simple question: "What is software?" A very simple answer is: Hardware you can touch, software you can't. But that is too simple indeed. Source URL: http://www.thocp.net/software/software_reference/introduction_to_software_history.htm Saylor URL: http://www.saylor.org/courses/cs101/ Attributed to: The History of Computing Project www.saylor.org Page 1 of 23 But when talking about software you talk about programming and programming languages. But about producing and selling the products made by programming (languages) as well. There are over 300 different ("common") computer languages in existence, apart from the various dialects stemming from one of them. Most of them can be classified in definable groups, but others don’t belong to anything. Some because they are rather new or the use of them was or is never wide spread and only used by a small specialized...

Words: 5456 - Pages: 22

Free Essay

The Effect of Communication on the Employee Performance in an Organization

...objective…………………………………. 8 4.Scope of the project 9 5.Significance of the system 10 6. Methodology and tools 11 6.1 System development methodology…….. 11 6.2Programming and database tools………. 11 6.3 Hardware specifications hardwarerequirements…………………………… 12 7. Feasibility analysis 13 7.1 Economic feasibility……………………………. 14 7.2 Technical feasibility……………………………. 14 7.3Operational feasibility……………………………….. 14 8. Limitation and requirements 14 9. Data collection methodology 15 10. Time schedule 15 11.Buget analysis 16 Chapter one proposal 1. INRODUCTION * Peoples need their basic needs for survive their life in a good condition. * For their achievement of basic need the peoples need peace and security to full fill their basic need then peace and security is the key concept in the living environment for any work that you help for your life. * Governments and peoples support to peace and security for their sustainable development for their country. * Government and society needs to control any activity that face the development in a worst condition. * The basic thing that fall the development of the county due to crime. * Crime should prevent for better peace and stability and for development activities. * Crime is too bad for peoples and governments in general then I went to proposed a project in the interesting title on online crime management system * The project titled as “Online...

Words: 6601 - Pages: 27

Free Essay

The Boss

... Bob Smith, CEO From: Jake Schmidt Attch: resig.doc Dear Bob, I wanted to respond to your memo of the 16th. Circulated as it was to seemingly half the company I feel we developers are now operating under an insurmountable stigma. Yes, we all know the product shipped late. Very late. You want to know why the schedule was missed so badly, and want an action plan to assure this problem will never reoccur. I was just one of many developers on the project. Others on the team will probably respond with apologetic platitudes. However, you'll note my resignation is attached so I feel no pressure to paper over the very real problems with politically-correct but worthless suggestions. Let me assure you, that, contrary to your strongly-stated opinion, we were not "spending half our time surfing the net for porn instead of cranking code", nor was the team composed of "laggards and slackers." Therein lies the first problem: engineering was treated with contempt and disrespect throughout the task. Each of us are college-educated, highly trained engineers with years of experience. Yet we're viewed as cogs in the system, replaceable elements whose sole mission is to...

Words: 2456 - Pages: 10

Premium Essay

C# and Asp.Net Project by Shivprasad Koirala Sham Shaikh

...C# and ASP.NET Projects By Shivprasad Koirala Sham Shaikh Visit us http://www.questpond.com for free interview question e-book. Mail bpb@bol.net.in to buy the book Write to the author directly at shiv_koirala@yahoo.com The e-Book is free but below are the limitation of this free e-book:-- The book has only 5 projects which are far less than what the actual book contains. -- Practical Videos and code walkthrough of the projects is not available for download. -- The book also has lot of installations provided in CD even that is not available for Download. Finally hard copy is a hard copy if you are interested below are the ways you can buy the Book:• Buy directly from the Author call 09867628636. If you are buying from the Author You get a chance to meet him and believe us you will enjoy it. Please send DD of Rupees 300 in favor of (Please send us detail that you want a hard copy or E-book CD) Shivprasad Bist E – 8, Amar Nager , Hoechst Colony , Opposite ShreeRam towers Mulund West Mumbai 82. • Call your city book shop MUMBAI-22078296/97/022-22070989, KOLKATA22826518/19,HYDERABAD-24756967,24756400,BANGALORE25587923,25584641,AHMEDABAD-26421611, BHATINA(PUNJAB)2237387,CHENNAI-28410796,28550491,DELHI/NEWDELHI23254990/91,23325760,26415092,24691288 • Are you a Pakistani reader then contact M/s. Vanguard Books P Ltd, 45 The Mall, Lahore, Pakistan (Tel: 0092-427235767, 7243783 and 7243779 and Fax: 7245097) E- mail: vbl@brain.net.pk • If you are not from india or pakistan :- ...

Words: 16342 - Pages: 66

Premium Essay

C Sharp Project

...C# and ASP.NET Projects By Shivprasad Koirala Sham Shaikh Visit us http://www.questpond.com for free interview question e-book. Mail bpb@bol.net.in to buy the book Write to the author directly at shiv_koirala@yahoo.com The e-Book is free but below are the limitation of this free e-book:-- The book has only 5 projects which are far less than what the actual book contains. -- Practical Videos and code walkthrough of the projects is not available for download. -- The book also has lot of installations provided in CD even that is not available for Download. Finally hard copy is a hard copy if you are interested below are the ways you can buy the Book:• Buy directly from the Author call 09867628636. If you are buying from the Author You get a chance to meet him and believe us you will enjoy it. Please send DD of Rupees 300 in favor of (Please send us detail that you want a hard copy or E-book CD) Shivprasad Bist E – 8, Amar Nager , Hoechst Colony , Opposite ShreeRam towers Mulund West Mumbai 82. • Call your city book shop MUMBAI-22078296/97/022-22070989, KOLKATA22826518/19,HYDERABAD-24756967,24756400,BANGALORE25587923,25584641,AHMEDABAD-26421611, BHATINA(PUNJAB)2237387,CHENNAI-28410796,28550491,DELHI/NEWDELHI23254990/91,23325760,26415092,24691288 • Are you a Pakistani reader then contact M/s. Vanguard Books P Ltd, 45 The Mall, Lahore, Pakistan (Tel: 0092-427235767, 7243783 and 7243779 and Fax: 7245097) E- mail: vbl@brain.net.pk • If you are not from india or pakistan :- ...

Words: 16342 - Pages: 66

Free Essay

Java Basics

...1 Learn Java/J2EE core concepts and key areas With Java/J2EE Job Interview Companion By K.Arulkumaran & A.Sivayini Technical Reviewers Craig Malone Stuart Watson Arulazi Dhesiaseelan Lara D’Albreo Cover Design, Layout, & Editing A.Sivayini Acknowledgements A. Sivayini Mr. & Mrs. R. Kumaraswamipillai 2 Java/J2EE Job Interview Companion Copy Right 2005-2007 ISBN 978-1-4116-6824-9 The author has made every effort in the preparation of this book to ensure the accuracy of the information. However, information in this book is sold without warranty either expressed or implied. The author will not be held liable for any damages caused or alleged to be caused either directly or indirectly by this book. Please e-mail feedback & corrections (technical, grammatical and/or spelling) to java-interview@hotmail.com First Edition (220+ Q&A): Dec 2005 Second Edition (400+ Q&A): March 2007 3 Outline SECTION DESCRIPTION What this book will do for you? Motivation for this book Key Areas index SECTION 1 Interview questions and answers on: Java Fundamentals Swing Applet Performance and Memory issues Personal and Behavioral/Situational Behaving right in an interview Key Points SECTION 2 Interview questions and answers on: Enterprise Java J2EE Overview Servlet JSP JDBC / JTA JNDI / LDAP RMI EJB JMS XML SQL, Database, and O/R mapping RUP & UML Struts Web and Application servers. Best practices and performance considerations. Testing and deployment. Personal and...

Words: 23255 - Pages: 94

Free Essay

Computer

...CONTENT Page No 1 2 3 4 5 6 7 8 9 10 Academic calendar Digital Communications Microprocessors and microcontrollers Digital Signal Processing Object Oriented Programming Through Java Managerial Economics And Financial Analysis Digital Signal Processing Lab Microprocessor & Microcontroller Lab Advanced English Communication Skills Lab Object Orient Programming Through Java Lab 2 3 48 85 129 186 217 219 222 224 ACADEMIC CALENDAR VIGNAN INSTITUTE OF TECHNOLOGY AND SCIENCE DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING DEPARTMENT ACADEMIC CALENDAR B. Tech Academic Year 2013 - 2014 - II - Semester S.No Event Date th 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. Submission of abstracts of main project by IV years Faculty orientation program Commencement of Class work Spell for UNIT – I Instructions Fresher’s day Spell for UNIT – II Instructions Alumni meet VIGNAN TARANG Spell for Unit-III Instructions st nd Assignment -1/ Unit test-1 on I & II Units Submission of results & week students list to Dept Spell for Unit-IV Instructions University I-Mid-Exam- II & IV Year rd University I-Mid-Exam- III Year Spell for UNIT – V Instructions for II &IV years rd Spell for UNIT – V Instructions for III year LAB INTERNAL-1 Commencement of Special classes for Slow learners Spell for UNIT – VI Instructions for II &IV years rd Spell for UNIT – VI Instructions for III year Submission of Mini project title along with guide for III year Spell for Unit...

Words: 28702 - Pages: 115

Premium Essay

Dssdfsdf

...India Community Initiative .NET Tutorial for Beginners Special thanks to the following who have put in sincere efforts to write and bring this tutorial together. Akila Manian (MVP) | Ajay Varghese (MVP) | Amit Kukreja | Anand M (MVP) | Aravind Corera (MVP) | Arvind Rangan | Balachandran | Bipin Joshi (MVP) | C S Rajagopalan | G Gokulraj | G Arun Prakash | Gurneet Singh (MVP) | Kunal Cheda (MVP) | Manish Mehta (MVP) | Narayana Rao Surapaneni (MVP) | Pradeep | Saurabh Nandu (MVP) | Shankar N.S. | Swati Panhale | Reshmi Nair Content 1. Getting Ready .......................................................................................... 4 1.1 Tracing the .NET History..............................................................................4 1.2 Flavors of .NET...........................................................................................5 1.3 Features of .NET....................................................................................... 10 1.4 Installing the .NET Framework SDK............................................................. 12 2. Introduction to the .NET Initiative and the .NET Platform ...................... 15 2.1 Understanding the Existing Development Scenario........................................ 15 2.2 Challenges faced by developers.................................................................. 18 2.3 NET Philosophy / Where does .NET fit in? .................................................... 21 2.4 Understanding...

Words: 22096 - Pages: 89

Free Essay

Test

...Starter Kit Copyright © 2013 Hakin9 Media Sp. z o.o. SK Table of Contents Angular: The DOM API You Have Been Waiting For Brad Davis 08 11 16 26 34 43 Angular.js, a javascript library and framework created in Google, is a fresh view into building great web applications. You can read a lot of articles on how it separates the concerns of the application, improves testability, and keeps to web app best practices, but I want to highlight a feature that is not shown off as regularly, extending the document object model API. Introduction to AngularJS Dylan Stamat You will learn about some of the core concepts that make AngularJS shine, including binding data to you views, built-in filtering, and some of the interesting architectural decisions behind this MVC framework. We will build a very simple application with local data that show some of these concepts. Diving into Angular Josh Kuhn In this tutorial we’re going to create a barebones Twitter-like application called Pipr. Pipr allows you to create “pips” which are short 100 character or less “pips” that show up on the page in reverse chronological order. You can add tags to your pips, and you can post them with any name you like. In addition, you can delete your pips. AngularJS 101: A Beginner’s Tutorial Karmen Blake This tutorial on AngularJS will guide you through the fundamentals of the framework. You will explore the exciting benefits of using a client-side JavaScript framework to create dynamic...

Words: 22760 - Pages: 92

Free Essay

John Walkenbach - Excel Vba Programming

...How to go to your page This eBook includes two bonus chapters, which are paginated separately from the rest of the book. The pagination of the bonus chapters consists of the identifer “BC” followed by the page number. For example, to go to page 5 of the bonus chapters, type BC5 in the “page #” box at the top of the screen and click “Go.” To go to page 15, type BC15… and so forth. Get More and Do More at Dummies.com ® Start with FREE Cheat Sheets Cheat Sheets include • Checklists • Charts • Common Instructions • And Other Good Stuff! To access the Cheat Sheet created specifically for this book, go to www.dummies.com/cheatsheet/excelvbaprogramming Get Smart at Dummies.com Dummies.com makes your life easier with 1,000s of answers on everything from removing wallpaper to using the latest version of Windows. Check out our • Videos • Illustrated Articles • Step-by-Step Instructions Plus, each month you can win valuable prizes by entering our Dummies.com sweepstakes. * Want a weekly dose of Dummies? Sign up for Newsletters on • Digital Photography • Microsoft Windows & Office • Personal Finance & Investing • Health & Wellness • Computing, iPods & Cell Phones • eBay • Internet • Food, Home & Garden Find out “HOW” at Dummies.com *Sweepstakes not currently available in all countries; visit Dummies.com for official rules. Excel VBA Programming ® FOR DUMmIES 2ND ‰ EDITION by John Walkenbach Excel® VBA Programming For Dummies®, 2nd Edition Published...

Words: 98776 - Pages: 396