Question: C# programing Single inheritance Part 1 Given an integer numbers N, create a class ' ProblemSolution' which demonstrates inheritance with the following characteristics 1. Must

C# programing

Single inheritance Part 1

Given an integer numbers N, create a class 'ProblemSolution' which demonstrates inheritance with the following characteristics

1. Must inherit from 'Base' class. 2. Create a 'solution' method with an integer parameter and void return type. 3. The 'solution' method should assign the given value N into 'Base' class property 'num' and call the 'display' function of 'Base' class.

What is inheritance? Inheritance is a mechanism in which one object acquires all the properties and behaviors of the parent object. Reference: https://www.javatpoint.com/c-sharp-inheritance

Input 50

Output 50

Please fill in the partial code below

using System; using System.Collections.Generic; using System.Linq;

//write your code here

public class Base { public int num; public void display () { Console.Write (num); } }

class DriverMain {

public static void Main () { int N = int.Parse (Console.ReadLine ()); ProblemSolution problemsolution = new ProblemSolution (); problemsolution.solution (N); } }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!