Suggested Answer:
Note: CustomerID is declared private. CompanyName is declted protected. State is declared protected. The protected keyword is a member access modifier. A protected member is accessible from within the class in which it is declared, and from within any class derived from the class that declared this member.
its no , yes , yes , private fields are on accessible within the containing class , protected fields are accessible in derived classes and public fields are available everywhere
First statement is about HAVING the property, but not about being inherited. When Customer is extended, CustomerID is not part of the derived class. You can create a new property with the same name without restrictions, and both properties will exist in their corresponding layer. It is the same behavior as using NEW. https://dotnetfiddle.net/z8Aj6G
The answer is NO YES YES.
As some stated before, this is not was the answers are about. The wording ist "have xyz as a property". Sure, only the public one is actually accessible but the other ones EXIST. So the anwer is Yes,Yes,Yes
No, the first and the third question show fields, not properties. Only the second question shows a property because it has a public access modifier. So the correct answer should indeed be No, Yes, No.
The proof is not a valid proof. The answer should be No, Yes, Yes.
In the proof the code tried to access a.State in Main function, which is outside of the derived class hence the compilation failed.
Here is how the proof should be:
One can add function in the derived class MyCustomerClass, such as
public string GetStateFromBase() { return this.State;}.
But one can NOT add the following function in the derived class MyCustomerClass:
public string GetCustomerIdFromBase() {return this.CustomerId;}
One cannot access CustomerId or State outside of Customer class or derived class as the properties are private or protected - such as from Main in the invalid "Proof".
Yes,Yes,Yes
Derived classes inherit members from all of their base classes.
The keywords private, public and protected affect only the accessibility of the items they are applied to. If something is not accessible in a particular context and you try to use it, the compiler will give you an error.
yes, yes, yes.
Explanation:
Private members in base classes are inherited but are not accessible from derived
https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/members
it doesn't say accessible. It says "inherits as a property". New instances of derived classes will have their own private member. So, "Yes, yes yes" is indeed correct.
Here the question is about which members are inherited, and not, if they are accessible.
Due to the fact, that all members are inherited (inclusive private members, but there are not accessible), the correct answers should be:
Yes, Yes, Yes
upvoted 7 times
...
This section is not available anymore. Please use the main Exam Page.70-483 Exam Questions
Log in to ExamTopics
Sign in:
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
kartal
Highly Voted 5 years, 11 months agosupersunny
Highly Voted 5 years, 11 months agoRoro2011
Most Recent 4 years, 4 months agoDaGrooveNL
4 years, 5 months agoKnarfy
4 years, 6 months agoSamSerpieol
4 years, 6 months agoMarcoFlorian
4 years, 6 months agoLoki93
5 years agoLoki93
5 years agonickname0815
4 years, 11 months agoBart_v_M
4 years, 10 months agondlp43
4 years, 11 months agotaotao
4 years, 9 months agosan0659
5 years agoTonyBezerra
5 years, 3 months agoosaki
5 years, 6 months agoIryna
5 years, 7 months agonatsk8freak
5 years, 6 months agobleasdal3
5 years, 5 months agoKhanyie
5 years, 7 months agoMitsoshima
6 years ago