The creator of the child class "Caesar" gives an error saying that the name, type is unreachable due to its security level is. how? Since it is a child class taken from the "cipher" class, it should not give any such error. How can I overcome this situation? But I want them to be private, I do not want to change them as people.
*** The second code example works. Can anyone see the difference?
Namespace encryption {class cipher {public cipher (string name, string type) {setName (name); SetType (type); } Private string name; Private string type; Public Zero Setname (String Nuaman) {name = newName; } Public string getName () {return name; } Public Zero Set Type (String New Type) {type = newType; } Public string getType () {return type; } Public string encrypt (string text) {return text; } Public string decrypt (string text) {return text; }}} Namespace encryptor {class caesar: cipher {private intit shift; Private string shifting; Public Seizer (Int Shift, String Shift Decrease): Base (name, type) {set shift (change); SetShiftdirection (shiftdirection); } Public Zero Set ShiftMount (Int NoughtsMount) {shiftamount = newShiftamount; } Public int acquisition () {return shift; } Public Zero Set-up performance (string new shift division) {shiftdirection = newShiftdirection; } Get public string shipment () {shift shifting; }}} ----------------------------- New Edit ----- -----------
class MyFile {public MyFile (int id, string name, integer shape, string type) {setId (id); SetName (name); SetSize (size); SetType (type); } Private int ID; The name of the private string; Private string type; Private integer size; Class movie: MyFile {Private string indicator; Private int release_eur; Public Movie (String Director, Int Release_eur, Int id, String Name, Int size): Base (ID, Name, Size, "M") {Set Director (Director); SetRelease_year (RELEASE_YEAR); } It seems that you made a mistake in defining a derived class constructor. If you want to get the name and type values for Superclass, you will have to give them additional constructor logic (for the overall 4 arguments, the constructor in the derived class For example, it should be changed: Public cursor (int shift, string paragraph, string name, string type): base (name, type) There are many other strategies you can take.
Comments
Post a Comment