Help Me TransportationMode c++ question, please help me figure this out


What is Stack overflow ?




In software, a stack overflow occurs if the call stack pointer exceeds the stack bound. The call stack may consist of a limited amount of address space, often determined at the start of the program. The size of the call stack depends on many factors, including the programming language, machine architecture, multi-threading, and amount of available memory. When a program attempts to use more space than is available on the call stack (that is, when it attempts to access memory beyond the call stack's bounds, which is essentially a buffer overflow), the stack is said to overflow, typically resulting in a program crash.


Post @stack overflow : 


c++ question, please help me figure this out, thank ...

Question: C++ question, Please help me figure this out, than...



C++ question, Please help me figure this out, thank You!

Write a class named 'TransportationMode' with two member variables that are NOT public, int wheels, and float mph.

Include necessary Constructors and two functions:

float timeToDestination(float miles); // Returns a float in terms of hours of how long it takes to travel given the current mode of transportations mph

void sayModeOfTransportation(); --> Should say exactly "I am traveling on an unknown mode of transportation."

Write two more classes, Car and Bike that inherit from TransportationMode.

These should have no member variables. Make the constructor for each such that Bikes have 2 wheels and travel at 15.0 mph, and cars have 4 wheels and travel at 60.0 mph.

Each of the derived class should overload the function 'void sayModeOfTransportation()' and instead cout..

"I am traveling on a bike."

"I am traveling in a car."

Don't overload the timeToDestination method.

Finally, the TransportationMode class should have a friend function named getWheels that takes a TransportationMode object as a parameter. You should declare this inside the class BUT as is the case with a friend function, you should define it outside of the class. You should not create any getter or setter functions to accomplish this.

Video @stack overflow : 

https://www.youtube.com/watch?v=KBk-ayp6yyU


1 comment: