Computer Science, asked by hayakhan139, 5 months ago

define an abstract class called parking space which includes an abstract method ShowSpaceType to show the type of parking in c++ w8th full practicle​

Answers

Answered by prakashkkaladindi
0

Answer:

. Define an abstract class called ParkingSpace, which includes an abstract method showSpaceType to show the type of the parking space.

2. Define a class RegularParkingSpace, which is a derived class of ParkingSpace.

a. Add a constructor which makes a regular parking space with a given space number. Override the abstract method showSpaceType to show this is a "Regular Parking Space".

3. Define a class HandicappedParkingSpace, which is a subclass of ParkingSpace.

a. Add a constructor which makes a handicapped parking space with a given space number. Override the abstract method showSpaceType to show this is a "Handicapped Parking Space".

4. Define a class ParkingLot. A parking lot generally has a number of parking spaces. (You are asked to use composition).

a. Add a default constructor which initialises a parking lot with 5 parking spaces. The first two spaces numbered 1000 and 1001 are handicapped parking spaces. The other three spaces are numbered 1002, 1003 and 1004 and are regular parking spaces.

b. Add a method that returns the number of parking spaces in the parking lot.

5. In your main function, declare and instantialise a parking lot using default constructor.

Print the type of every parking space in this parking lot, such as "Parking space 1001: It is a handicapped parking space."

Your code MUST reflect the use of polymorphism. Otherwise, your submission will result in no grade

Similar questions