Free Essay

It/218 Object Oriented Programming

In:

Submitted By AcesUp08093
Words 813
Pages 4
Object oriented programming refers to a method of programming in which individual objects, usually called "methods" and "functions", are created and used in junction with each other to perform a function. These objects are organized within the program through use of things called structures or classes.

A class is something we use to create a blueprint of sorts for a assortment of variables and components. Similarly, a structure serves the same purpose. The only difference between a structure and a class is that a structure's members are public by default and a classes members are private by default.

Another form of "blueprint" used by programmers is the data union. While a union is very primitive in comparison to a structure or class, it is a good tool to use to conserve memory in larger applications. A union uses the same memory block for multiple variables at different points. While two variables in a union cannot be accessed at the same time, a union is a good way to re-use blocks of memory that would normally be left void after a variable is finished with.

Now that I have covered the basic points of classes, structures and unions, I will go into more detail of just how powerful a class or structure can be. In basic reference, a class is simply a blueprint to something we create instances of later in the program. This is a very vague statement however, because in object-oriented programming the class is the backbone of the program. It is what makes the program do what it is intended to do.

Members of a class are private by default, though they can be made selectively public by adding the "public:" notation before any members that are to be public. A public member of a class, typically a variable, is accessible from outside the class. A private variable is not accessible from outside the class and can only be modified or used from within the class. Below are examples of public and private variables and how they are used:

One may take notice the only difference between the class PublicVariables and PrivateVariables is that PublicVariables contains the "public:" notation before the variable declarations. This makes the variables contained within public, but what does that mean? Well, if we were to desire to change or access the variables in class PrivateVariables, we would have to create public methods and functions within the class to do so. Because a class is private by default, any variables or methods we desire to be public have to be notated as such. Because a structure is public by default, the opposite applies.

Both structures and classes can also inherit methods and attributes from other classes. Inheritance is an important tool in object-oriented programming. It allows us to use methods and attributes from other classes in new classes without having to re-write hundreds or thousands of lines of code. The importance of having inheritance available grows exponentially as programs become larger and classes grow in size. Below is an example of a class "Bravo" inheriting properties from class "Base".

In this example, class Bravo extends class Base, or in other words "inherits" the variables C, D and E from the Base class. The function "int function()" in class Bravo is able to return the value of "int C" from class Base because it is inherited to class Bravo from Base.

Finally, an important aspect of object oriented programming languages is polymorphism. polymorphism refers to objects or operators that act differently in different syntax. A simple example of polymorphism is the addition sign, "+". This operator will work in a slightly different way depending on the syntax used. For instance, if two integers are on either side of the "+" operator it will be used as mathematical addition. Below is an example with two lines of code using the "+" operator:

In this example, we have three integers, A, B, and C, and a string, D. In the first line of code after the variable declaration, the + operator is used as basic addition of integers by adding A and B and setting it to C's value. In the second line of code after the variable declaration, the + operator takes a different role. In the code "D = D + "word", the + operator is used to combine two strings. It will take "word" and add it to the end of the string "D". The + operator taking on two different roles is a perfect yet basic example of polymorphism.

Object-oriented programming languages offer many powerful capabilities. From the memory-conserving capabilities of Unions to the functionality and inheritance abilities of Classes and Structures, object-oriented programming languages such as C++ have given us the ability to take programming to the next level. Polymorphism has simplified the process and added even more functionality to an already extensive list of capabilities.

Similar Documents

Premium Essay

Object Oriented Programming

...Object Oriented Programming IT/218 Object-Oriented Programming (OOP) provides computer programmers not only a new way to program, but a new way to think in terms of objects. This type of programming (“Object oriented programming,” 2012) allows programmers to use objects as a way of thought versus using a procedural language and organizing by data structures and algorithms. This is a new way of programming centered on objects to develop programs. C++ gives the programmer a way to incorporate encapsulation, inheritance, and polymorphorism and C++ also provides many ways of support Object-Oriented Programming. Programming was once thought upon as using a series of tasks for the computer to perform but object-oriented programming uses a collection of objects. In this type of programming, each object can receive message and process data, as well as send other messages to fellow objects. By placing information where it is not accessible by the entire computer program, OOP (“Object oriented programming,” 2012) calls the data using methods. The methods then act as intermediaries for working on the data they control. Object-oriented programs center on different types of objects. Each object contains a kind of data that manages the information within the program itself. The method of the object will use a system of checks and safeguards that are defined in the types of data the object contains. Because of this system, adaptations to the program can be...

Words: 465 - Pages: 2

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

Design Pattern

...Design Patterns Elements of Reusable Object-Oriented Software Produced by KevinZhang Design Patterns: Elements of Reusable Object-Oriented Software Contents Preface to CD ........................................................ 5 Preface to Book ...................................................... 7 Foreword ............................................................. 9 Guide to Readers .................................................... 10 1 Introduction ...................................................... 11 1.1 What Is a Design Pattern? ...................................... 12 1.2 Design Patterns in Smalltalk MVC ............................... 14 1.3 Describing Design Patterns ..................................... 16 1.4 The Catalog of Design Patterns ................................. 18 1.5 Organizing the Catalog ......................................... 21 1.6 How Design Patterns Solve Design Problems ...................... 23 1.7 How to Select a Design Pattern ................................. 42 1.8 How to Use a Design Pattern .................................... 44 2 A Case Study: Designing a Document Editor ......................... 46 2.1 Design Problems ................................................ 46 2.2 Document Structure ............................................. 47 2.3 Formatting ..................................................... 53 2.4 Embellishing the User Interface ................................ 56 2.5 Supporting Multiple...

Words: 84976 - Pages: 340

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

Free Essay

Seven Languages in Seven Weeks

... Venkat Subramaniam Award-winning author and founder, Agile Developer, Inc. As a programmer, the importance of being exposed to new programming languages, paradigms, and techniques cannot be overstated. This book does a marvelous job of introducing seven important and diverse languages in a concise—but nontrivial—manner, revealing their strengths and reasons for being. This book is akin to a dim-sum buffet for any programmer who is interested in exploring new horizons or evaluating emerging languages before committing to studying one in particular. Antonio Cangiano Software engineer and technical evangelist, IBM Fasten your seat belts, because you are in for a fast-paced journey. This book is packed with programming-language-learning action. Bruce puts it all on the line, and the result is an engaging, rewarding book that passionate programmers will thoroughly enjoy. If you love learning new languages, if you want to challenge your mind, if you want to take your programming skills to the next level—this book is for you. You will not be disappointed. Frederic Daoud Author, Stripes ...and Java Web Development Is Fun Again and Getting Started with Apache Click Prepared exclusively for Montelymard Do you want seven kick starts into learning your “language of the year”? Do you want your thinking challenged about programming in general? Look no further than this book. I personally was taken back in time to my...

Words: 85787 - Pages: 344

Free Essay

Java Programming

...A Programmer’s Guide to Java™ SCJP Certification Third Edition This page intentionally left blank A Programmer’s Guide to Java™ SCJP Certification A Comprehensive Primer Third Edition Khalid A. Mughal Rolf W. Rasmussen Upper Saddle River, New Jersey • Boston • Indianapolis • San Francisco New York • Toronto • Montreal • London • Munich • Paris • Madrid Capetown • Sidney • Tokyo • Singapore • Mexico City Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and the publisher was aware of a trademark claim, the designations have been printed with initial capital letters or in all capitals. The authors and publisher have taken care in the preparation of this book, but make no expressed or implied warranty of any kind and assume no responsibility for errors or omissions. No liability is assumed for incidental or consequential damages in connection with or arising out of the use of the information or programs contained herein. The publisher offers excellent discounts on this book when ordered in quantity for bulk purchases or special sales, which may include electronic versions and/or custom covers and content particular to your business, training goals, marketing focus, and branding interests. For more information, please contact: U.S. Corporate and Government Sales (800) 382-3419 corpsales@pearsontechgroup.com For sales outside the United...

Words: 15086 - Pages: 61

Free Essay

Student

...CONCEPTS OF PROGRAMMING LANGUAGES TENTH EDITION This page intentionally left blank CONCEPTS OF PROGRAMMING LANGUAGES TENTH EDITION R OB E RT W. S EB ES TA University of Colorado at Colorado Springs Boston Columbus Indianapolis New York San Francisco Upper Saddle River Amsterdam Cape Town Dubai London Madrid Milan Munich Paris Montreal Toronto Delhi Mexico City Sao Paulo Sydney Hong Kong Seoul Singapore Taipei Tokyo Vice President and Editorial Director, ECS: Marcia Horton Editor in Chief: Michael Hirsch Executive Editor: Matt Goldstein Editorial Assistant: Chelsea Kharakozova Vice President Marketing: Patrice Jones Marketing Manager: Yez Alayan Marketing Coordinator: Kathryn Ferranti Marketing Assistant: Emma Snider Vice President and Director of Production: Vince O’Brien Managing Editor: Jeff Holcomb Senior Production Project Manager: Marilyn Lloyd Manufacturing Manager: Nick Sklitsis Operations Specialist: Lisa McDowell Cover Designer: Anthony Gemmellaro Text Designer: Gillian Hall Cover Image: Mountain near Pisac, Peru; Photo by author Media Editor: Dan Sandin Full-Service Vendor: Laserwords Project Management: Gillian Hall Printer/Binder: Courier Westford Cover Printer: Lehigh-Phoenix Color This book was composed in InDesign. Basal font is Janson Text. Display font is ITC Franklin Gothic. Copyright © 2012, 2010, 2008, 2006, 2004 by Pearson Education, Inc., publishing as Addison-Wesley. All rights reserved. Manufactured...

Words: 142312 - Pages: 570

Free Essay

Concepts of Programming Languages

...CONCEPTS OF PROGRAMMING LANGUAGES TENTH EDITION This page intentionally left blank CONCEPTS OF PROGRAMMING LANGUAGES TENTH EDITION R O B E RT W. S EB ES TA University of Colorado at Colorado Springs Boston Columbus Indianapolis New York San Francisco Upper Saddle River Amsterdam Cape Town Dubai London Madrid Milan Munich Paris Montreal Toronto Delhi Mexico City Sao Paulo Sydney Hong Kong Seoul Singapore Taipei Tokyo Vice President and Editorial Director, ECS: Marcia Horton Editor in Chief: Michael Hirsch Executive Editor: Matt Goldstein Editorial Assistant: Chelsea Kharakozova Vice President Marketing: Patrice Jones Marketing Manager: Yez Alayan Marketing Coordinator: Kathryn Ferranti Marketing Assistant: Emma Snider Vice President and Director of Production: Vince O’Brien Managing Editor: Jeff Holcomb Senior Production Project Manager: Marilyn Lloyd Manufacturing Manager: Nick Sklitsis Operations Specialist: Lisa McDowell Cover Designer: Anthony Gemmellaro Text Designer: Gillian Hall Cover Image: Mountain near Pisac, Peru; Photo by author Media Editor: Dan Sandin Full-Service Vendor: Laserwords Project Management: Gillian Hall Printer/Binder: Courier Westford Cover Printer: Lehigh-Phoenix Color This book was composed in InDesign. Basal font is Janson Text. Display font is ITC Franklin Gothic. Copyright © 2012, 2010, 2008, 2006, 2004 by Pearson Education, Inc., publishing as Addison-Wesley. All rights reserved. Manufactured in the United States...

Words: 142253 - Pages: 570

Free Essay

Dbms Class

...Exercises 74 iii iv Contents Chapter 7 Relational-Database Design Exercises 84 Chapter 8 Object-Oriented Databases Exercises 98 Chapter 9 Object-Relational Databases Exercises 109 Chapter 10 XML Exercises 119 Chapter 11 Storage and File Structure Exercises 129 Chapter 12 Indexing and Hashing Exercises 141 Chapter 13 Query Processing Exercises 155 Chapter 14 Query Optimization Exercises 166 Chapter 15 Transactions Exercises 175 Chapter 16 Concurrency Control Exercises 182 Chapter 17 Recovery System Exercises 194 Contents v Chapter 18 Database System Architectures Exercises 201 Chapter 19 Distributed Databases Exercises 208 Chapter 20 Parallel Databases Exercises 217 Chapter 21 Application Development and Administration Exercises 225 Chapter 22 Advanced Querying and Information Retrieval Exercises 232 Chapter 23 Advanced Data Types and New Applications Exercises 241 Chapter 24 Advanced Transaction Processing Exercises 249 C H A P T E R 1 Introduction Chapter 1 provides a general overview of the nature and purpose of database systems. The most important concept in this chapter is that database systems allow data to be treated at a high level of abstraction. Thus, database systems differ significantly from the file systems and general purpose programming environments with which students are already familiar. Another important aspect of the chapter is to provide motivation...

Words: 41091 - Pages: 165

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

Ds Java

...A Practical Introduction to Data Structures and Algorithm Analysis Third Edition (Java) Clifford A. Shaffer Department of Computer Science Virginia Tech Blacksburg, VA 24061 April 16, 2009 Copyright c 2008 by Clifford A. Shaffer. This document is the draft of a book to be published by Prentice Hall and may not be duplicated without the express written consent of either the author or a representative of the publisher. Contents Preface xiii I Preliminaries 1 1 Data Structures and Algorithms 1.1 A Philosophy of Data Structures 1.1.1 The Need for Data Structures 1.1.2 Costs and Benefits 1.2 Abstract Data Types and Data Structures 1.3 Design Patterns 1.3.1 Flyweight 1.3.2 Visitor 1.3.3 Composite 1.3.4 Strategy 1.4 Problems, Algorithms, and Programs 1.5 Further Reading 1.6 Exercises 3 4 4 6 8 12 13 14 15 16 17 19 21 2 Mathematical Preliminaries 2.1 Sets and Relations 2.2 Miscellaneous Notation 2.3 Logarithms 2.4 Summations and Recurrences 25 25 29 31 33 iii iv Contents 2.5 2.6 2.7 2.8 2.9 3 II 4 Recursion Mathematical Proof Techniques 2.6.1 Direct Proof 2.6.2 Proof by Contradiction 2.6.3 Proof by Mathematical Induction Estimating Further Reading Exercises Algorithm Analysis 3.1 Introduction 3.2 Best, Worst, and Average Cases 3.3 A Faster Computer, or a Faster Algorithm? 3.4 Asymptotic Analysis 3.4.1 Upper Bounds 3.4.2 Lower Bounds 3.4.3 Θ Notation 3.4.4 Simplifying...

Words: 30587 - Pages: 123

Free Essay

Flex 3 - a Beginners Guide - 9780071544184.31985.Pdf

...Flex 3: ™ A Beginner’s Guide Michele E. Davis Jon A. Phillips New York Chicago San Francisco Lisbon London Madrid Mexico City Milan New Delhi San Juan Seoul Singapore Sydney Toronto Copyright © 2008 by The McGraw-Hill Companies. All rights reserved. Manufactured in the United States of America. Except as permitted under the United States Copyright Act of 1976, no part of this publication may be reproduced or distributed in any form or by any means, or stored in a database or retrieval system, without the prior written permission of the publisher. 0-07-160364-6 The material in this eBook also appears in the print version of this title: 0-07-154418-6. All trademarks are trademarks of their respective owners. Rather than put a trademark symbol after every occurrence of a trademarked name, we use names in an editorial fashion only, and to the benefit of the trademark owner, with no intention of infringement of the trademark. Where such designations appear in this book, they have been printed with initial caps. McGraw-Hill eBooks are available at special quantity discounts to use as premiums and sales promotions, or for use in corporate training programs. For more information, please contact George Hoare, Special Sales, at george_hoare@mcgraw-hill.com or (212) 904-4069. TERMS OF USE This is a copyrighted work and The McGraw-Hill Companies, Inc. (“McGraw-Hill”) and its licensors reserve all rights in and to the work. Use of this work is subject to these terms. Except as...

Words: 51940 - Pages: 208

Free Essay

Oops

...Preface No programming technique solves all problems. No programming language produces only correct results. No programmer should start each project from scratch. Object-oriented programming is the current cure-all — although it has been around for much more then ten years. At the core, there is little more to it then finally applying the good programming principles which we have been taught for more then twenty years. C++ (Eiffel, Oberon-2, Smalltalk ... take your pick) is the New Language because it is object-oriented — although you need not use it that way if you do not want to (or know how to), and it turns out that you can do just as well with plain ANSI-C. Only object-orientation permits code reuse between projects — although the idea of subroutines is as old as computers and good programmers always carried their toolkits and libraries with them. This book is not going to praise object-oriented programming or condemn the Old Way. We are simply going to use ANSI-C to discover how object-oriented programming is done, what its techniques are, why they help us solve bigger problems, and how we harness generality and program to catch mistakes earlier. Along the way we encounter all the jargon — classes, inheritance, instances, linkage, methods, objects, polymorphisms, and more — but we take it out of the realm of magic and see how it translates into the things we have known and done all along. I had fun discovering that ANSI-C is a full-scale object-oriented language...

Words: 72330 - Pages: 290

Free Essay

John Walkenbach - Excel Vba Programming

... 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 by Wiley Publishing, Inc. 111 River Street Hoboken, NJ 07030-5774 www.wiley.com Copyright © 2010 by Wiley Publishing, Inc., Indianapolis, Indiana Published by Wiley Publishing, Inc., Indianapolis, Indiana Published simultaneously in Canada No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means, electronic, mechanical,...

Words: 98776 - Pages: 396

Premium Essay

Java

...to network security. The book is updated where appropriate throughout, and the rhythm of text, code, tables, and illustrations is superb. It's a valuable resource for the developer who is elbow-deep in demanding projects. Table of Contents Java 2 Preface - 7 Part l The Java Language - The Complete Reference - 4 Chapter 1 Chapter 2 Chapter 3 Chapter 4 Chapter 5 Chapter 6 Chapter 7 Chapter 8 Chapter 9 hapter 10 - The Genesis of Java - 9 - An Overview of Java - 20 - Data Types, Variables, and Arrays - 36 - Operators - 57 - Control Statements - 75 - Introducing Classes - 94 - A Closer Look at Methods and Classes - 111 - Inheritance - 134 - Packages and Interfaces - 156 - Exception Handling - 174 Chapter 11 - Multithreaded Programming - 188 Chapter 12 - I/O, Applets, and Other Topics - 214 Part ll The Java Library Chapter 13 - String Handling - 235 Chapter 14 - Exploring java.lang - 255 Chapter 15 - java.util Part 1: The Collections Framework - 297 Chapter 16 - java.util Part 2: More Utility Classes - 343 -2- Chapter 17 - Input/Output: Exploring java.io - 362 Chapter 18 - Networking - 397 Chapter 19 - The Applet...

Words: 78285 - Pages: 314