Implement the vector class using inheritance

Assignment Help C/C++ Programming
Reference no: EM13165436

Q: Is it better to implement the Vector class using inheritance (is-a relationship) or composition (has-a relationship). In other word, which one of the following gives a better implementation?

1. A Vector is a Point

2. A Vector uses a Point to help on the implementation

List the advantages and disavantages on both approaches.

Not sure on adavantages and disavantages, need assistance on basic understanding.

Reference no: EM13165436

Questions Cloud

Calculate and display the number of units of electricity : The manager of PG&E wants a program that calculates a customer's electric bill. He will enter the current and previous meter readings.
Jerry has done some analysis : Jerry has done some analysis about the profit ability of the bicycle shop. If Jerry builds the large bicycle shop, he will earn $60,000 if the market is good, but he will lose $40,000 if the market is bad
Design a 8m x 32 bit memory board : design a 8M x 32 bit memory board. You may use only 256K x 8 bit RAM chips with full parallel addressing.
Create a book class : Create a Book class. In addition to properties of author and isbn, with setters/getters, the Book should override Object's base method "boolean equals(Object)" and have a "boolean validate()" method.
Implement the vector class using inheritance : Is it better to implement the Vector class using inheritance (is-a relationship) or composition (has-a relationship). In other word, which one of the following gives a better implementation?
Compute the beginning balance in the cash account : Compute the beginning balance in the cash account and how much cash was provided by (or used in) operating activities
Determine the activation energy for this reaction : The first-order rearrangement of CH3NC is measured to have a rate constant of 3.61 x 10-15 s-1 at 298 K and a rate constant of 8.66 × 10-7 s-1 at 425 K. Determine the activation energy for this reaction.
Include a main function that will solicit : Include a main function that will solicit a DNA sequence string from the user, call the genes function to obtain all the genes in the sequence and print each one on the console display
Create entries for monthly expenses : We are not creating entries for monthly expenses such as rent and preparing the financial statements and documents floating around that may or may not be needed for efficient and effective processing of the business information and paper that is no..

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Native method with deadlock detection and recovery

The naïve method with deadlock avoidance and the naïve method with deadlock detection and recovery - what will you measure and compare in order to determine the winner or which is better

  First display the smallest volume and then the largest volum

first display the smallest volume and then the largest volume.

  Write a driver program called testrationalnumber.cpp

Write a driver program called testRationalNumber.cpp to test each of the above functions and overloaded operators in the RationalNumber class.

  Recursive function

What is the result of the following recursive function when called with mm(10)? Write out the execution trace of this call to mm(10).

  Smallest sequence of numbers in the array

Write a function called sum_smallest_sequence() that accepts an array of  signed  integers and the  number  of items in the array as arguments, and returns the sum of the smallest sequence of numbers in the array.

  Design is known, what advantages does keeping

Given that the design is known, what advantages does keeping the source code unavailable give the company and those who purchase the software? What disadvantages does it cause?

  Programs written with inheritance

Many programs written with inheritance could be written with composition instead, and vice versa. Rewrite the classes Point3D, Sphere and Cylinder using composition rather than inheritance

  Design, write, and test a program

Design, write, and test a program that represents some of the aspects of a student

  Write a program to crypt its input accordingly

Write a program to crypt its input according to a specified transformation scheme

  Write program to input series of hourly temperatures

Create and write a c++ program which inputs series of 24 hourly temperatures from file, and outputs bar chart (using stars) of temperatures for the day.

  Write a function to arrange 10 numbers stored in an arraye

Writ a funtion to arrange 10 numbers stored in an array forom the largest to the smallest and pass the results to main program.

  Write program function prompt user for number of elements

Write a C++ program main function which will prompt the user for the number of elements called N desired for an array which has the capacity to store 50 elements.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd