4
Answers

Is Possible,single Property use for 5 more same type fields?

Arun Kurmi

Arun Kurmi

11y
1.1k
1
hi friends,
I have a class Student.Where i declare 5 private field:
marksInMaths,marksInEng,marksInPhy,marksInChem and marksInHin.Then i created a seperate property with get{} and set{} for each namely Math,Phy,Chem,Eng and Hin. All the properties have same purpose for their respective subject.So i think  if it is Possible perform  all the five properties task in  a single property then reduce my code.Is Possible??? if yes then please give an example.
Answers (4)