Which two actions should you perform?

You are creating a class named Employee. The class exposes a string property named EmployeeType.
The following code segment defines the Employee class. (Line numbers are included for reference only.)

The EmployeeType property value must be accessed only by code within the Employee classor within a class
derived from the Employee class.
The EmployeeType property value must be modified only by code within the Employee classor
You need to ensure that the implementation of the EmployeeType property meets the requirements.
Which two actions should you perform? (Each correctanswer represents part of the complete solution.
Choose two.)

You are creating a class named Employee. The class exposes a string property named EmployeeType.
The following code segment defines the Employee class. (Line numbers are included for reference only.)

The EmployeeType property value must be accessed only by code within the Employee classor within a class
derived from the Employee class.
The EmployeeType property value must be modified only by code within the Employee classor
You need to ensure that the implementation of the EmployeeType property meets the requirements.
Which two actions should you perform? (Each correctanswer represents part of the complete solution.
Choose two.)

A.
Replace line 05 with the following code segment: protected get;

B.
Replace line 06 with the following code segment: private set;

C.
Replace line 03 with the following code segment: public string EmployeeType

D.
Replace line 05 with the following code segment: private get;

E.
Replace line 03 with the following code segment: protected string EmployeeType

F.
Replace line 06 with the following code segment: protected set;

Explanation:
BE protected string EmployeeType { get; private set; } is only correct answer
AB and AF would not compile because of error: Cannot specify accessibility modifiers for both accessors of the
property or indexer



Leave a Reply 18

Your email address will not be published. Required fields are marked *


MarcoJacob

MarcoJacob

would say B and E or?

Mr D

Mr D

For sure, AF, ridiculous question!

MarcoJacob

MarcoJacob

It`s B and E.

protected string EmployeeType { get; private set; }

If you take A and F so you would receive an Error, because you cant use “protected” in an internal property. Also you don`t meet the requirement “The EmployeeType property value must be modified only by code within the Employee class” so the setter has to be “private”

LoverBoy1

LoverBoy1

Agree. Best explanation here

kubra

kubra

I saw diffrent question.

“The EmployeeType property value must be accessed and modified only by code within the Employee class or within a class derived from the Employee class.”

Result, Which two actions should you perform?

Jack

Jack

B and E
F allows setting by derviced classes

Google

Google

That could be the end of this write-up. Here youll locate some web pages that we believe you will enjoy, just click the links.

employee

employee

always a massive fan of linking to bloggers that I really like but dont get a whole lot of link really like from

Convert here for free

Convert here for free

we like to honor a lot of other world wide web web pages on the internet, even if they arent linked to us, by linking to them. Under are some webpages really worth checking out

PC Games to Download

PC Games to Download

The info mentioned in the write-up are a number of the ideal readily available

the book of ra

the book of ra

below you will obtain the link to some websites that we think you should visit

Fliesendekor-Bad

Fliesendekor-Bad

we came across a cool web site that you may possibly love. Take a look for those who want

app creator

app creator

one of our guests a short while ago recommended the following website

drink coaster

drink coaster

below youll find the link to some sites that we consider you must visit

Wood burning pizza oven Pizza Party

Wood burning pizza oven Pizza Party

always a major fan of linking to bloggers that I appreciate but dont get quite a bit of link like from

online data entry jobs from home

online data entry jobs from home

one of our guests just lately suggested the following website

LS

LS

B and E
B prevents value and E prevents setting new value in not inherited class.