ここで、Student_info はクラスです。異なる長さの文字列で初期化しようとしていますが、入力文字列の長さに依存するはずの場合、常に同じサイズのオブジェクトが得られます。助言がありますか?(Name と Company は、char 配列ではなく、文字列変数として定義されます)
Structure of class Student_info
{ string name, company;
int yr, age;
}
Student_info *s[5];
s[0]= new Student_info("Aakash Goyal","form MNNIT Allahabad",2,57);
cout<<endl<<s[0]->getCompany()<<" is the company"<<endl;
cout<<endl<<s[0]->getName()<<" is the name and the size is: "<<sizeof(*s[0]);
s[1]= new Student_info("Hare Krishna","Hare Krsna Hare Rama",1,34);
cout<<endl<<s[1]->getCompany()<<" is the company"<<endl;
cout<<endl<<s[1]->getName()<<" is the name and the size is: "<<sizeof(*s[1]);