Reading a book states that the derived class gets all the fields and methods ... but what about the properties ??
Personal methods, fields and attributes are not generally, although a derived class is the area of all methods and, yes Also handles properties. Visible from direct access or derived class until it is nested in the superclass (parent). However, contractors and finals, they are not inherited, when you get in a way, you need to code any constructor required for your object initialization, even if it's the base class constructor. Makes a call.
However, it is generally considered to be a good practice to access your fields and make derivative classes through properties, if necessary. In this way, it assures you, the writer of the base class, that you can control the way the classes can change the state (the value of its area).
You explained the question about the qualities:
the person in the public category {public name {get; Set; } Public Zero Greetings () {Console.WriteLine ("Hello"); }} Public Square Child: Person {public nickname} In the above example, the derivative property (name) and its derivative method (greeting) in addition to its name (a property) in the derived class, child,
Comments
Post a Comment