Free Essay

Oop Concepts

In: Computers and Technology

Submitted By sufyan92
Words 482
Pages 2
www.kbcafe.com

OOP Concepts by Example by Randy Charles Morin Of late, I have been writing very narrow focused articles that explain how to accomplish this or that task. Many of you have changed your questions from the narrow focus of how-to questions to broader theorectical questions. One question I got lately that intrigue me was to explain the concepts of OOPs showing C++ examples. Let's start by laying down some ground work. I assume that you are familar with the following OOP concepts; classes, objects, attributes, methods, types. If not, then this article might not be in your realm. I'd suggest starting with the basic concepts of C++ before you attempt to understand the more indepth concepts that I'll be discussing in this article. When we speak of OOP concepts, the conversation usually revolves around encapsulation, inheritance and polymorphism. This is what I will attempt to describe in this article.

Inheritance
Let us start by defining inheritnace. A very good website for finding computer science definitions is http://www.whatis.com. The definitions in this article are stolen from that website. Definition: Inheritance Inheritance is the concept that when a class of object is defined, any subclass that is defined can inherit the definitions of one or more general classes. This means for the programmer that an object in a subclass need not carry its own definition of data and methods that are generic to the class (or classes) of which it is a part. This not only speeds up program development; it also ensures an inherent validity to the defined subclass object (what works and is consistent about the class will also work for the subclass). The simple example in C++ is having a class that inherits a data member from its parent class. class A { public: integer d; }; class B : public A { public: };

The class B in the example does not have any direct data member does it? Yes, it does. It inherits the data member d from class A. When one class inherits from another, it acquires all of its methods and data. We can then instantiate an object of class B and call into that data member. void func() { B b; b.d = 10; };

Copyright 2001-2002 Randy Charles Morin

www.kbcafe.com

Polymorphism
Inheritance is a very easy concept to understand. Polymorphism on the other hand is much harder. Polymorphism is about an objects ability to provide context when methods or operators are called on the object. Definition: Polymorphism In object-oriented programming, polymorphism (from the Greek meaning "having multiple forms") is the characteristic of being able to assign a different meaning to a particular symbol or "operator" in different contexts. The simple example is two classes that inherit from a common parent and implement the same virtual method. class A { public: virtual void f()=0; }; class B { public: virtual void f() {std::cout…...

Similar Documents

Premium Essay

Oops

...better prepared for success in life and schoolwork by developing a solid foundation of accurate and rational application of the economic perspective and reasoning as it relates to personal, business and national economic matters. b) Have a clear overview and understanding of how a market economy functions and the relationships of its major subdivisions or aggregates, such as the government, households, and business sectors. Emphasis [in this class] will be placed on the U.S. Economy and its linkages to the global economy. c) Be familiar with economic growth and economic performance measures. d) Understand the determination of prices and national income e) Use graphs and tables to illustrate important economic models and concepts f) Analyze economic policies and predict their effects, special attention will be placed on relating or linking classroom theory to real world situations. Note: These objectives require students to go beyond memorization or recall to understanding and application of the basic principles of macroeconomics. The attainment of these objectives will provide economic literacy for students not going beyond the introductory course and an adequate foundation for further work. . . * COURSE REQUIREMENTS: * Testing Policy/Grading System: Evaluation: Your final grade in this course will be determined from three examinations; a common final......

Words: 4002 - Pages: 17

Premium Essay

Concept

...Men and Women’s Shopping Concept For Women, shopping can be a very fun experience, especially sometimes when we see any sales on the item that we’ve been wanting for a long time and buy. There is a little different for men, because most men find shopping is boring and they don’t like to walk through a crowed mall. The first difference is women are very hesitant when they comes to shopping, because we can not make up our minds about what we want to get, or what we like. Men always look like know what they want to buy and need then pick only that item up. Ladies can take hours to getting one item, while men can get three items in 10 minutes or maybe less. Women spend more money than men because women want everything that they see. Men and women are really different in shopping concept. First, women are hesitant when shopping but men are not. A woman goes into a store with every plan on getting one item. When a woman sees all lovely things at a store, she wants to buy them all, and sayings “buy me.” But when she go to other store sees other cute things, she wants to buy that too. That is why a woman can be very hesitant. When a man says that he’s going to buy one thing from the store, it’s a guarantee that he will come home with that item because things do not scream out at him, “buy me”. Secondly, a woman always can take longer time to shop that a man does. A lady has to look at everything she finds appealing to the eye. Some women knows when they go shopping are for a......

Words: 1562 - Pages: 7

Premium Essay

Business Concepts and Concepts

...Business Cycles and Concepts Sabrina Negron American Intercontinental University Online Abstract An employee of the World Bank has been asked to research unemployment concerns in Chile and to write a report of his/her findings. The employee has been asked to research data sets for unemployment and state the relationships between unemployment and Chile’s economy. The employee must answer what trends he/she finds in the data sets and to support those trends with statistical evidence. In today’s economic turmoil one only needs to look at Chile to gain a better view. According to www.thisischile.cl the country is ranked second according to the Economic Climate Index (ICE). Chile is ranked second after Brazil in Latin America. Chile has reached a 7.8 ICE score a vast improvement over the 1990 score of 2.9. According to the New York Times (2011) “Chile is home to the world's largest copper producer.” Chile also produces wines and fruit with agriculture accounting for 15 percent of Chile’s total exports. As stated by Krugman & Wells (2009) “Unemployment is the number people who are actively looking for work but aren’t currently employed.” Krugman & Wells (2009) also states that “The unemployment rate is the percentage of the total number of people in the labor force who are currently not unemployed.” A country’s economy has a direct effect on the unemployment rate. If the economy is good unemployment rates are usually low, if the economy is bad the......

Words: 1068 - Pages: 5

Premium Essay

Concept

...Concept Essay There are many fears within this world. Most of these fears we live with for the rest of our lives while others just fade into our memories. There are fears that are so traumatic that people live their lives around that one single thing they are afraid of. Many ways have been found to allow ourselves to overcome and triumph these fears we hold so close to our hearts and psyches. Phobias are the fears that we hold onto throughout our lives from childhood to adulthood because they are irrational and excessive. You may ask “What is it?” A phobia is a “persistent, excessive, unrealistic fear of an object, person, animal, activity, or situation” (Intelihealth). It is a type of anxiety disorder, a person with a phobia may either try to avoid the thing that triggers the fear or endures it with great complications. In most cases, the phobia involves a sense of “endangerment or a fear of harm” (Cherry). People may either live with one phobia or they could be stacked upon each other, which is a very rare case. I am lucky to only live with one fear and that happens to be Acrophobia (fear of heights) but it is not severe in any way. Everyone falls under one of these three categories of phobias due to their reaction and level of anxiety. They are Specific Phobia, Social Phobia, and Agoraphobia; The first one referring to a simple fear, the second one referring to fear of judgment, and the last as a fear of embarrassment (Wikipedia). Since my fear is a fear of......

Words: 631 - Pages: 3

Premium Essay

Concept

...Dallana Ahumada English 101, Section 1582 5 May 2014 Paper 2B: Concept Motherhood/Mother It is said, observed and a proven a universal truth as well that, a mother, regardless of her specie in terms of life and living, will continue to feed and love her child even if she herself is deprived or incapacitated. Motherhood is not something you can take lightly. Entering into motherhood shoves two decades' worth of responsibilities into your life. Preparing to handle motherhood is one step toward being a good mom. As a mother, you have a multitude of jobs, from being an at-home teacher to being an emotion coach. But all these jobs have the same ultimate goal: turning your child into an independent, productive adult. Mothers are required to have diplomatic skills, negotiating matters of importance, like sharing. They are required to constantly research and adapt systems to meet the ever-changing nutritional, educational, psychological and spiritual needs of their children, without sacrificing their commitments as a wife. It's a 24-hour-a-day job, and there's often no training to prepare a woman for the tasks at hand. A mother, whether she is ready for it or not, must let her roles evolve in order to meet the demands and needs of her children. As children age, the roles of motherhood will change to help the mother raise children of various ages. Perhaps mothers with children of various ages have a tougher role, as they must care for numerous children and children of wide age......

Words: 1094 - Pages: 5

Premium Essay

Oop Intruduction

...Introduction to Objects “We cut nature up, organize it into concepts, and ascribe significances as we do, largely because we are parties to an agreement that holds throughout our speech community and is codified in the patterns of our language … we cannot talk at all except by subscribing to the organization and classification of data which the agreement decrees.” Benjamin Lee Whorf (1897-1941) The genesis of the computer revolution was in a machine. The genesis of our programming languages thus tends to look like that machine. But computers are not so much machines as they are mind amplification tools (“bicycles for the mind,” as Steve Jobs is fond of saying) and a different kind of expressive medium. As a result, the tools are beginning to look less like machines and more like parts of our minds, and also like other forms of expression such as writing, painting, sculpture, animation, and filmmaking. Object-oriented programming (OOP) is part of this movement toward using the computer as an expressive medium. This chapter will introduce you to the basic concepts of OOP, including an overview of development methods. This chapter, and this book, assumes that you have some programming experience, although not necessarily in C. If you think you need more preparation in programming before tackling this book, you should work through the Thinking in C multimedia seminar, downloadable from www.MindView.net. This chapter is background and supplementary material. Many......

Words: 2752 - Pages: 12

Free Essay

Oops

...application. As an example, consider a client of a window managing a list of graphical objects. The elegant solution is to let the client belong to a subclass of List but the implementation of a window forces the client to be something like a WindowHandler. As we discussed in section 4.9 we can make an aggregate and let the client contain a List object, but then our class hierarchy evolves according to the dictate of the system rather than according to the needs of our application problems. Finally, an abstract base class defining callback functions tends to define no private data components for its objects, i.e., the class declares but does not define methods and the objects have no private state. While this is not ruled out by the concept of a class it is certainly not typical and it does suggest that the abstract base class is really just a collection of functions rather than of objects and methods. 10.3 Delegates 113 _ __________________________________________________________________________ 10.3 Delegates Having made a case against abstract base classes we need to look for a better idea. It takes two to callback: the client object wants to be called and the host does the calling. Clearly, the client object must identify itself to the host, if it wants the host to send it a message, but this is all that is required if the host can ask the client what callbacks it is willing to accept, i.e., what methods it can respond to. It is significant that......

Words: 72330 - Pages: 290

Free Essay

Concept

...receive a kidney by age thirteen because he is responding to treatment, but he could take a turn for the worst at any time. Matthew's father finds out about a system where he could pay someone for a matching kidney to keep his son alive. While Matthew’s father sees this as a potential option, this system is illegal in the United States and many other countries around the world. Five to ten percent of all organ transplants are obtained through an organ trade (“Is It Ever Right” 36). Organ trade is also known as organ trafficking. To better understand organ trafficking, it’s best to know what it is, to what extent it occurs, and what consequences there are for traffickers, victims, and recipients. In order to know more about this concept, it is important to know the definition of organ trafficking: Organ trafficking entails the recruitment, transport, transfer, harboring or receipt of persons, by means of threat or use of force or other forms of coercion, of abduction, of fraud, of deception, of the abuse of power, of a position of vulnerability, of giving or receiving of payments or benefits to achieve the consent of a person having control over another person, for the purpose of exploitation by the removal of organs, tissues, or cells for transplantation. (Budiani-Saberi and Delmonico 925) This definition captures the amount of exploitation used in soliciting a donor in an illegal organ trade (Budiani and Delmonico 926). The exploitation can bring up......

Words: 1291 - Pages: 6

Premium Essay

Concept

...invasion into the body Wash hands before and after each patient care activity Obtain blood, sputum, urine and wound cultures upon initial suspicion of onset of sepsis Administer antimicrobial agents as ordered to treat the infection and subsequently decrease the release of inflammatory mediators Consult physician if signs and symptoms persist or worsen 1. Infection related to microorganism invasion into the body Wash hands before and after each patient care activity Obtain blood, sputum, urine and wound cultures upon initial suspicion of onset of sepsis Administer antimicrobial agents as ordered to treat the infection and subsequently decrease the release of inflammatory mediators Consult physician if signs and symptoms persist or worsen Concept Mapping Name F.G._____________________ 5. Activity Intolerance r/t continuous bedrest and fatigue Allow for periods of rest before and after planned exertion periods such as meals, baths, treatments, and physical activity Monitor and maintain mechanical ventilator settings for respiratory Refrain from performing non-essential procedures 5. Activity Intolerance r/t continuous bedrest and fatigue Allow for periods of rest before and after planned exertion periods such as meals, baths, treatments, and physical activity Monitor and maintain mechanical ventilator settings for respiratory Refrain from performing non-essential procedures 2. Decreased cardiac output related to abnormal inflammation Assess patient’s HR, BP and......

Words: 478 - Pages: 2

Free Essay

Concepts

...Accountability as a Concept Wendie Malkinski Theoretical Foundations of Advanced Nursing Dr. Linda Phelps November 29, 2015 Accountability as a Concept Accountability in the field of nursing is very important as everything we do can either save or take lives. When mistakes are made at this level of care it affects public trust and someone must take responsibility for mistakes and also life saving measures. This is one of the cornerstones of the medical profession as a whole. As we have taken an oath to do no harm. Responsibility equals accountability. Accountability shows in many ways, shapes and forms. This concept also shows up in more than just the medical field, and nursing. It appears in everything from architecture, government, and even our personal lives. All throughout history the concept of accountability has appeared on the canvas. For example, President Truman embraced the term “The buck stops here”. Basically saying that instead of passing the blame or the “buck”, the responsibility lies with him as our leader and president. (The Harry S. Truman Library, n.d.). What the Literature Says During a preliminary literature search, I found the accountability concept displayed in many different disciplines and categories. For example, I found accountability mentioned in the medical field, government, sociology, psychology, and even engineering / architecture. Going a little......

Words: 1015 - Pages: 5

Free Essay

Oop Concepts with Real Life Example and Codes

...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...

Words: 1017 - Pages: 5

Free Essay

Management Concept

...also having to maintain a growing volume of existing software. 1.4 Software Myths The myths presented in this section provide a good source of material for class discussion. Managers need to understand that buying hardware and adding people does not spontaneously solve all software development problems. Customers need to understand that computer software does not make all their other problems go away. If the customer can not define his or her needs clearly, it is not possible to build a software product to meet these needs. If a customer does not have defined business processes without computer support, building computer software will not create these processes automatically. Software engineers must be committed to the concept of doing things right the first time. Software quality does not happen on its own after a product is finished. Quality must be built into every portion of the software development process. PROBLEMS AND POINTS TO PONDER 1.1. Classic examples include the use of "digital automobile dashboards" to impart a high tech, high quality images. Appliances that "think;" the broad array of consumer electronics; personal computers (today, differentiated more by their software function than the hardware), industrial instrumentation and machines. All e-commerce applications are differentiated by software. 1.2. The apprentice/artist culture of the 1950s and 1960s worked fine for single person, well constrained projects. Today,......

Words: 43682 - Pages: 175

Premium Essay

Concepts

...be only by education and institutions. An organization can and does make use of such institutions in order to support and supplement its internal training development effort. DISTINCTION BETWEEN TRAINING AND DEVELOPMENT:- “Training is short term process utilizing a systematic and organized procedure by which non managerial personnel learn technical knowledge and skills for definite purposes……. Development is a long term educational process utilizing a systematic and organized procedure by which managerial personnel learn conceptual and theoretical knowledge for general purpose”. “Training” refers only to instruction in technical and mechanical operations, while “development” refers to philosophical and theoretical educational concepts. Training is designed for non-managers, while development involves managerial personnel. In the words of Campbell, “training courses are typically designed for a short term, started set purpose, such as the operation of some piece(s) of machinery, while development involves a border education for long term purposes.” NEED FOR BASIC PURPOSES OF TRAINING Basic purposes of training are …………. 1. “To increase productivity : Instruction can help employees increase their level of performance on their present assignment. Increased human performance often directly leads to increased operational productivity and increased company profit. Again, increased performance and productivity, because of training, are most evident on the part of......

Words: 12801 - Pages: 52

Free Essay

Concepts

...The Concepts of Music Dylan Wright Pitch/Melody Pitch represents the fundamental frequency of a sound reflecting generally the lowness or highness of a sound and the melody is the pitch and rhythm combined. In Australian popular music composers tend to pick one or two melodies (verse and chorus) and stick with them. The variety then occurs in the lyrics. The beat and the melodies in pop songs have a tendency to be simple, with limited harmonic accompaniment. This is so the piece is catchy and remains in our head. The pitch is usually within a one octave range, for the simple reason of the vocalist being unable to reach certain notes. It also makes it ‘singable’ for the listeners. What's more, this means that there are no large leaps from notes as popular music is more written with small steps of notes rather than octave leaps. In more recent Australian popular music, it has become less uncommon for us to hear pitch perfect vocals. The reasoning behind this is an ingenious plug-in called Auto-Tune. It’s a studio trick that can take a vocal and instantly nudge it onto the proper note or move it to the correct pitch. You could say it's like Photoshop for the human voice. It can transform an okay performance into something technically flawless. Pitch and melody play a big part in Australian Popular music because, obviously, something that is not pleasing to our ears is not going to entice listeners. Duration Duration is the amount of time in a piece and how long it lasts...

Words: 915 - Pages: 4

Premium Essay

Oop Stack

...but also the types of operations (functions) that can be applied to the data structure. In this way, the data structure becomes an object that includes both data and functions. In addition, programmers can create relationships between one object and another. For example, objects can inherit characteristics from other objects. One of the principal advantages of object-oriented programming techniques over procedural programming techniques is that they enable programmers to create modules that do not need to be changed when a new type of object is added. A programmer can simply create a new object that inherits many of its features from existing objects. This makes object-oriented programs easier to modify. There are five characteristics of OOP such as below. Class & Object – Allow programmer to look at a system in a whole different way. Encapsulation – Encapsulation is capturing data and keeping it safely and securely from outside interfaces. Inheritance - This is the process by which a class can be derived from a base class with all features of base class and some of its own. This increases code reusability. Polymorphism - This is the ability to exist in various forms. For example an operator can be overloaded so as to add two integer numbers and two floats. Abstraction - The ability to represent data at a very conceptual level without any details. We are going to describe and solve two problems using Encapsulation. First we need to define what encapsulation is.......

Words: 853 - Pages: 4

Play Movie | Best Match | Mit Amazon Prime könnt ihr bald alle Fast Furious-Filme schauen (außer den emotionalsten)