aminmix
جمعه 09 خرداد 1393, 08:35 صبح
چرا این کد عددی رو که از وروودی میگیره پس از ارث بری نمیتونه درست در خروجی نشون بده ? :متعجب:
شرایط شبیه به این در برنامه ام برای من پیش اومده و نمیدونم چکارش کنم.
کامپایلر Dev
#include <iostream>
#include <string>
using namespace std;
class classroom{
public:
int totalStudents;
void getnumber(){
cout<<" Enter a number to inherite ? " ;
cin>>totalStudents;
}};
class checkList:public classroom{
private:
public:
void check(){
cout<<"The number is :"<<totalStudents<<endl;
}
};
main(){
classroom programming;
programming.getnumber();
checkList presenceList;
presenceList.check();
system("PAUSE");
return EXIT_SUCCESS;
}
شرایط شبیه به این در برنامه ام برای من پیش اومده و نمیدونم چکارش کنم.
کامپایلر Dev
#include <iostream>
#include <string>
using namespace std;
class classroom{
public:
int totalStudents;
void getnumber(){
cout<<" Enter a number to inherite ? " ;
cin>>totalStudents;
}};
class checkList:public classroom{
private:
public:
void check(){
cout<<"The number is :"<<totalStudents<<endl;
}
};
main(){
classroom programming;
programming.getnumber();
checkList presenceList;
presenceList.check();
system("PAUSE");
return EXIT_SUCCESS;
}