Customer center

We are a boutique essay service, not a mass production custom writing factory. Let us create a perfect paper for you today!

Example research essay topic: Three Types X Y - 799 words

NOTE: Free essay sample provided on this page should be used for references or sample purposes only. The sample essay is available to anyone, so any direct quoting without mentioning the source will be considered plagiarism by schools, colleges and universities that use plagiarism detection software. To get a completely brand-new, plagiarism-free essay, please use our essay writing service.
One click instant price quote

The problem is that we need to compress our programs while still having them function correctly and process items differently depending on type or class. The solution is polymorphism. Polymorphism in object oriented programming is the programming languages ability to process items differently depending on their data type or class. In other words, it is the ability to redefine methods for derived classes. The true rule for C++ polymorphism is that when one class, named A is derived from or inherits another class, named B, A can do anything that B can do, thus it can store pointers to A in variables declared as B.

Here are examples for and the definitions of the three types of polymorphism. If you were to have a base class named shape, polymorphism lets the programmer define different and separate circumference methods for any number of derived classes, such as circles, rectangles, and triangles. No matter what the shape of the object is, the circumference method will always return correct. This is an example of one of three types of polymorphism. This specific type is known as parameterized polymorphism, or parametric polymorphism. Another type of polymorphism is called overloading.

Overloading is a form of polymorphism that allows an object to have different meanings depending on context. It is most often used to reference operators that can behave differently because of the data type class or operands. This is best illustrated using X+Y. X+Y can mean different things depending on whether x and y are simple integer or complex data structures. Here is a clearer example: 4 + 5 integer addition 3. 14 + 2. 0 floating point addition s 1 + bar string concatenation! The final form of polymorphism is called pure polymorphism.

This form of polymorphism is a selection of a function at run time based on the class type and its position in an inheritance hierarchy. Now here is an example of polymorphism using people that a company might be interested in. They are defined in the following classes: class person { protected: char name, ident, address, phone; public: person (char n, char i, char a, char p); char getname (void); char get ident (void); char get address (void); char get phone (void); void set address (char a); void set phone (char p); void print (void); }; class customer: public person { protected: int rating, balance; etc etc etc }; class employee: public person { protected: char job title, supervisor; int salary; etc etc etc }; class family: public person { protected: char employee; etc etc etc }; class stockholder: public person { protected: int num shares; etc etc etc }; Through the mechanism of inheritance, all the four classes inherit the members: members name, ident, address, and phone; and the methods: getname, get ident, get address, get phone, set address, set phone, and print from person. Thus, no matter what extra functionality these classes have, they are always guaranteed to have all the functionality of a person. Anything you can possibly do to or with a person, you must also be able to do to or with a customer. A customer is a kind of person.

Without polymorphism, we would need a different list for each class and would also need to define separate but almost identical functions for searching each of the four arrays, and just about every other operation: { customer cust's[ 1000 ]; employee emp's[ 1000 ]; family em pfam[ 1000 ]; stockholder owners[ 100 ]; cust's[ 33 ] = new customer (, , ); emp's[ 175 ] = new employee (, , ); }. With polymorphism, we only need one array and just one search function: { person everyone[ 10000 ]; everyone[ 33 ] = new customer (, , ); everyone[ 175 ] = new employee (, , ) person find (char nm) { int i; for (i = 0; i NUMPEOPLE; strcmp (everyone[i]- &# 038; &# 038; (everyone[i]! = NULL if i+ = 1) name, nm) = = 0) return (everyone[i]); return (NULL); } In conclusion, polymorphism will save the hard working programmer lots of time. Sure it takes more understanding, but it is worth it when writing large programs. In the long run polymorphism will help the serious programmer become more efficient in his programming.

In my conclusions this is a better topic for someone in a more advanced class but it is a good way to save time when writing involved programs. I hope to learn more about this subject as I progress in my programming, and use this newfound knowledge to my advantage. Bibliography Deitel &# 038; Deitel How to program C++ 2 nd edition Copyright 1988 United States of America Internet. com web Copyright 1999 - 2000 internet. com Corp Webopedia web Copyright 1999 - 2000 internet. com Corp.

UNKNOWN web


Free research essays on topics related to: copyright 1999, three types, x y, char, void

Research essay sample on Three Types X Y

Writing service prices per page

  • $18.85 - in 14 days
  • $19.95 - in 3 days
  • $23.95 - within 48 hours
  • $26.95 - within 24 hours
  • $29.95 - within 12 hours
  • $34.95 - within 6 hours
  • $39.95 - within 3 hours
  • Calculate total price

Our guarantee

  • 100% money back guarantee
  • plagiarism-free authentic works
  • completely confidential service
  • timely revisions until completely satisfied
  • 24/7 customer support
  • payments protected by PayPal

Secure payment

With EssayChief you get

  • Strict plagiarism detection regulations
  • 300+ words per page
  • Times New Roman font 12 pts, double-spaced
  • FREE abstract, outline, bibliography
  • Money back guarantee for missed deadline
  • Round-the-clock customer support
  • Complete anonymity of all our clients
  • Custom essays
  • Writing service

EssayChief can handle your

  • essays, term papers
  • book and movie reports
  • Power Point presentations
  • annotated bibliographies
  • theses, dissertations
  • exam preparations
  • editing and proofreading of your texts
  • academic ghostwriting of any kind

Free essay samples

Browse essays by topic:

Stay with EssayChief! We offer 10% discount to all our return customers. Once you place your order you will receive an email with the password. You can use this password for unlimited period and you can share it with your friends!

Academic ghostwriting

About us

© 2002-2024 EssayChief.com