oop - Examples in Test Driven Development By Example by Kent Beck -
I am reading and one of the examples is to annoy me Chapter 3 (Equality for all) Writer in two Dollar creates a par function in the dollar class to compare objects:
public boolean par (object) Object) {dollar dollar = (dollar) object; Return amount == dollar Zodiac; } Then, in the following chapters (4: confidentiality), he makes the amount to the private member of the dollar class.
Private amount; And the test pass should not be a compiler error in the equal method because the object can use its amount member Is it amount member of the other dollar object?
// should not be associated with dollar. The amount of return == dollars Amount Am I a fundamental misconception private ?
UPDATE I decided to go back and return with the code manually and when I got the next part (Chapter 6 - All for Rows, Radius), where they Pushing the zodiac sign a guardian class and protecting it, I have access problems:
public square money {protected integer amount; } Public class dollar: money {public dollar (int sum) {this.amount = sum; } // override object. Avellus Public Override Balls Equals (Object Obze) {Money Dollar = (Money) oz; // "Error CS1540: Protected member 'money.mount' // can not be used through 'money' type of qualifier; Qualifier should be used // type 'dollar' (or received from) on next line Should: Refund amount == USD. Amount;}} Does this mean that the protected is based on the IS example-C #?
Yes, you're basically making personal misconceptions privacy class-specific Is not specific for example.
Comments
Post a Comment