Write a C++ program to demonstrate hierarchical inheritance to get square and cube of a number.

Question

Write a C++ program to demonstrate hierarchical inheritance to get square and cube of a number.
🧐 Not the exact question you are looking for?Go ask a question

Solution 1

Sure, here is a simple C++ program that demonstrates hierarchical inheritance to get the square and cube of a number.

#include<iostream>
using namespace std;

// Base class
class Number {
   protected:
      int num;
   public:
      void getNumber(int n) {
         num = n;
      }
};

// F
    Knowee AI StudyGPT is a powerful AI-powered study tool designed to help you to solve study prob
Knowee AI StudyGPT is a powerful AI-powered study tool designed to help you to solve study problem.
Knowee AI StudyGPT is a powerful AI-powered study tool designed to help you to solve study problem.
Knowee AI StudyGPT is a powerful AI-powered study tool designed to help you to solve study problem.
Knowee AI StudyGPT is a powerful AI-powered study tool designed to help you to solv

This problem has been solved

Similar Questions

Write a C++ program to demonstrate hierarchical inheritance to get square and cube of a number.

Write a programme in C++ which read and print employee information with department and pf information using hierarchical inheritance

Write a C++ program to find Reverse of a Number using class.inputEnter a number: 12345output54321

second smallest positive number greater than 11 that is both a perfect square and perfect cube

An even number can be expressed as the square of an integer as well as a cube of another integer. Then the number has to be necessarily divisible by:

1/3