string path; string info; Teacher teacher;
Let's say for example, I need to retrieve the name of the school that the teacher works for. The logic would be:
info = teacher.school.name;
Simple enough right? Is it possible obtain this information through a string path?
//************Pseudo //assigning the path path = "teacher.school.name" //returning the information by passing the object and its path through the parameters info = GetInfo(teacher, path);
Can this also be achieved with integers, boolean, and floats as well? Any assistance is greatly appreciated. Thanks!
Aucun commentaire:
Enregistrer un commentaire