星期四, 6月 04, 2015

朋友類別:需做修改

#include
using namespace std;
class car{
   private:
      int num;
      double gas;
};
class runcar:public car{
 public:
     /*
    runcar()
     {
      num=0;
      gas=10;
     }
     */
};
class classfriend
{public:
 static int power;
 static void setup(int power);
 };
 int classfriend::power=1;
class runclassfriend:public classfriend{
{

 public:;
     /*
    runclassfriend()
     {
      num=0;
      gas=10;
     }
     */
};
void classfriend::setup(int power)
{
int motive=power;
car march;
march.num=200;
march.gas=20.0;
runcar march1;
march1.num=2000;
march1.gas=40.0;
cout<<"--march--"<<"傳入為"<cout<<"--march1--"<<"號碼為"<cout<<"Gas為"<}
int main( )
{
classfriend::setup(300);
runclassfriend::setup(3000); //朋友的兒子?
car march;
classfriend classfriend1;
classfriend1.setup(20);
march.num=200;
march.gas=20.0;
runcar march1;
march1.num=2000;
march1.gas=40.0;
cout<<"--march--"<<"號碼為"<cout<<"--march1--"<<"號碼為"<return 0;
}

沒有留言:

張貼留言