In: Computer Science
(a) Why can't records use private data members (instead of public).
(b) Why shouldn't objects use public data members?
a) Why can't records use private data members(instead of public)
solution: Private data members cannot access the records outside of class its access only inside class and sometimes break the private data members access the outside of class crack the implementation of code
public data members: public data members huge increases in accessibility of records occurs and public data members can easy to change the code
So private data members to implementation is difficult acess the records and records can acess the outside of class thats why can't records use private data members
b) Why should't objects use public data members?
solution: because objects uses the public data members when its possible to changes the values of objects when its entire project code losses that why objects are use private data members
objects use private data members when its constant noone can change the value so its constant values declared as objects best way to implement the code
when its uses const keyword are used to declared the objects
please i kindly requesting upvote rating my answer and i clearly explain the solution is correct please rating my answer