Sao cái class teacher mình ko lấy dữ liệu họ tên với cmnd dc từ lớp person
Mã:
 #include "Teacher.h"
#include "Person.h"
#include <fstream>;

void Teacher::nhap(int lcb,int hsl)
{
	LCB=lcb;
	HSL=hsl;


	
}
//int Teacher::TinhLuong()
//{
//	luong=LCB*HSL;
//
//}
void Teacher::xuat()
{
	Person::xuat();
	ofstream out("OUTPUT.txt",  ios::out | ios::app);
	out<<LCB<<" "<<HSL<<" "<</*luong*/"luong teacher";
	out.close();
}
Mã:
#include "Person.h"
#include <fstream>

void Person::nhap(char ten[50],int cmnd)
{
	strcpy(hoten,ten);
	SCMND=cmnd;
}
void Person::xuat()
{
	ofstream out("OUTPUT.txt");
		out<<hoten<<" "<<SCMND;
		out.close();
		

}
còn đây là hàm main
Mã:
#include "Person.h"
#include "Student.h"
#include "Teacher.h"
#include <iostream>
#include <fstream>


void main()
{
	Teacher k;
	Person p;
	
	char ten[50];
	int scd;
	int lb,hl,scmndsv;
	char htsv[50];
	int t,v,a;
	ifstream in("INPUT.txt");
	in>>ten;
	in>>scd;
	p.nhap(ten,scd);
	in>>lb;
	in>>hl;
	k.nhap(lb,hl);
	
	//in>>htsv;
	//in>>scmndsv;
	//in>>t;
	//in>>v;
	//in>>a;
	in.close();
	k.xuat();
	
	
}
Nếu dùng p.xuat thì ho ten voi scmnd no ra đúng,nhưng class teacher nó kế thừa lại thì dữ liệu nó ra là số gì ak ko đúng