Creating an Object Dynamically

# Introduction In this lab, we will create a program that dynamically allocates memory to an object by creating a class named `Cube`, a constructor with an integer parameter `side`, and a `calculate_volume()` function to return the volume of the cube, then in `main()` we will get an integer input, dynamically create an object of `Cube`, pass the `side` variable as an argument to the constructor, call the `calculate_volume()` function, store the return value in a variable `volume`, print `volume`, and deallocate the memory using `delete`.

|
60 : 00

Click the virtual machine below to start practicing