Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1 . Give concise answers to the following questions / 1 0 a ) What is Encapsulation? / 5 b ) What are the differences

1. Give concise answers to the following questions /10
a) What is Encapsulation?
/5
b) What are the differences between a class and an abstract class?
/5
2. Design different classes in an inheritance hierarchy/relationship to represent different shapes (circle, square, triangle, rectangle, rhombus, and pentagon). All the shape classes should inherit from a common base class. The classes should contain functions to calculate the shapes area. Include any other relevant members you think may be needed. (Note that, in this task, you do not need to implement any method, only a class design diagram (or UML) with member fields, properties, and method signatures can satisfy this question.)
/10
3. What is the exact output of the program below?
public class Base
{
public Base()
{
Console.WriteLine("Base Constructor");
}
public virtual void Func()
{
Console.WriteLine("Base Func");
}
}
public class Derived : Base
{
public Derived()
{
Console.WriteLine("Derived Constructor");
}
public override void Func()
{
Console.WriteLine("Derived Func");
}
}
class Program
{
static void Main(string[] args)
{
var b = new Base();
b.Func();
var d = new Derived();
d.Func();
}
}
/10

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Concepts of Database Management

Authors: Philip J. Pratt, Joseph J. Adamski

7th edition

978-1111825911, 1111825912, 978-1133684374, 1133684378, 978-111182591

More Books

Students also viewed these Databases questions

Question

8. How are they different from you? (specifically)

Answered: 1 week ago