Arun Kurmi

Arun Kurmi

  • NA
  • 106
  • 72.4k

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

Mar 31 2013 3:14 PM
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)