PrepAway - Latest Free Exam Questions & Answers

Which two actions should you perform?

You create Microsoft Windows-based applications. You are creating a component that will be used by several client applications. The component contains the following code segment. (Line numbers are included for reference only.)

01 namespace MyComponent {
02 public class Account {
03 private string mAccountNo;
04 private decimal mBalance;
05 public Account(string AcctNo) {
06 …
07 }
08 public void Withdraw(decimal Amount) {
09 …
10 }
11 public void Deposit(decimal Amount) {
12 …
13 }
14 }
15 public class SavingsAccount:Account {
16 public SavingsAccount(string AcctNo):base(AcctNo) {
17 …
18 }
19 public void ApplyInterestRate(decimal Amount) {
20 …
21 }
22 }
23 }
You need to redesign the Account class and the SavingsAccount class to meet the following requirements:

Developers must not be able to instantiate the Account class from client applications. Developers must not be able to extend the functionality of the SavingsAccount class. Developers must be able to instantiate the SavingsAccount class from client applications.

Which two actions should you perform? (Each correct answer presents part of the solution. Choose two).

PrepAway - Latest Free Exam Questions & Answers

A.
Implement only private constructors for the Account class.

B.
Implement only private constructors for the SavingsAccount class.

C.
Implement only internal constructors for the Account class.

D.
Implement the SavingsAccount class as an abstract public class.

E.
Implement the SavingsAccount class as a concrete non-inheritable class.


Leave a Reply