全文预览

CPM Dairy奶牛饲料配方软件简介及其应用

上传者:似水流年 |  格式:docx  |  页数:3 |  大小:92KB

文档介绍
rtual void f( ) { cout << "B::f" << endl; }Р virtual ~B( ) { cout << "~B" << endl; }Р};Рclass D: public B {Рpublic:Р D( ) { cout << "D" << endl; }Р void f( ) { cout << "D::f" << endl; }Р virtual ~D( ) { cout << "~D" << endl; }Рprivate:Р A a;Р};Рvoid main( )Р{ B* pB = new D;Р pB->f( ); Р delete pB;Р}Р14. class MyclassР{public:Р Myclass(int a,int b,int c);Р void PrintNumber( );Р void PrintSum( );Р private:Р int A,B,C;Р static int Sum;Р};Р #include <iostream.h>Рint Myclass::Sum=10;Р Myclass::Myclass(int a,int b,int c)Р { A=a; B=b; C=c;Р Sum+=A+B+C;Р}Р void Myclass::PrintNumber() Р{ cout <<"Number="<<A<<","<<B<<","<<C<<endl;}Р void Myclass::PrintSum( )Р {cout<<"Sum="<<Sum<<endl;}Рvoid main( )Р{Р Myclass M(3,7,10), N(14,9,1);Р M.PrintNumber( ); N.PrintNumber( );Р M.PrintSum( ); N.PrintSum( );Р}

收藏

分享

举报
下载此文档