私が読んだことから、NSMutableArrayオブジェクトが追加されます。
Studentオブジェクトを としてキャストせずに、特定の位置からオブジェクト変数を出力するにはどうすればよいですかStudent。
Javaのようなものを探しているので、ArrayList<Student>簡単に印刷できます.ArrayList.get(i).getNameArrayList.get(i).getPrice
StudentRepository* myStudentRepo = [[StudentRepository alloc]init];
Student* myStudent = [[Student alloc]init];
myStudent.name = @"John";
// add a Student to the NSMutableArray
[myStudentRepo.studentRepository addObject:myStudent];
NSLog(@"Value: %@", myStudentRepo.studentRepository);
for(Student* myStudentItem in myStudentRepo.studentRepository)
{
NSLog(@"Value: %@", myStudentItem.name);
}
// print the Student from a given position
NSLog(@"Value: %@", [(Student*)[myStudentRepo.studentRepository objectAtIndex:0] name]);