struct student {
char *s_name;
struct student_id s_id;
/** Number of references to this student. */
unsigned int s_ref;
/** Transcript (singly-linked list, NULL terminator). */
struct transcript_entry *s_transcript;
/** Whether or not this student has completed his/her program. */
student_complete s_complete;
};
struct student* student_grad_create(const char *name, size_t namelen,
struct student_id, int phd);
struct student* student_undergrad_create(const char *name, size_t namelen,
struct student_id);
: 나는 그나마동일한 기능을하지만 서로 다른 매개 변수 전달이라는 기능을 구현해야 학생 세 종류의 <strong>마스터 학생 및 박사 과정 학생 및 학부 학생</strong> .I이 있습니다
int student_add_entry(struct student *, struct transcript_entry *);
을 학생 유형을 어떻게 결정할 수 있는지 알고 있습니까?
다음을 수행해야합니까?
int student_add_entry(struct student *undergrad_create, struct transcript_entry *){}
int student_add_entry(struct student *grad_create, struct transcript_entry *){}
감사합니다.
그건 아주 재미있는 생각입니다. 그걸로 무엇을 할 수 있겠습니까? –
'C'를 원하겠습니까? 어쨌든, 학생 타입을 나타내는'enum '은 어떨까요? –
C에 함수 오버로드가 없습니다. –