1 give an example of polymorphism write a method in c in a


1. Give an example of polymorphism. Write a method in C# in a base class so that it can be overridden in a derived class, and provide/write that method. (Should only contain two methods)

2. Consider the following section of code from the definition of class OfficeBuilding.

public class OfficeBuilding
{
public int sqrFeet;
private string name;
protected double cost;
public OfficeBuilding() { ... }
protected bool isBuilt(){ ... }
public void moveIn(){ ... }
public double rentSpace(){ ... }
private int renovate(int days) { ... }

a. Which members/methods are visible to (accessible from) OfficeBuilding and its subclasses?

b. Which members/methods are visible to (accessible from) only the OfficeBuilding class?

c. Which members/methods are visible to (accessible from) any class?

Solution Preview :

Prepared by a verified Expert
Basic Computer Science: 1 give an example of polymorphism write a method in c in a
Reference No:- TGS01402388

Now Priced at $10 (50% Discount)

Recommended (96%)

Rated (4.8/5)