Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
ex217.cpp
Package: VC6.0.rar [view]
Upload User: qdhmjx
Upload Date: 2022-07-11
Package Size: 2226k
Code Size: 1k
Category:
source in ebook
Development Platform:
Visual C++
- #include <iostream.h>
- class Base1 //定义基类Base1
- {
- protected:
- int m_B1; //定义基类的数据成员m_B1
- public:
- void Setm_B1(int x) //定义基类的成员函数Setm_B1
- {
- m_B1=x;
- }
- };
- class Base2 //定义基类Base2
- {
- protected:
- int m_B2; //定义基类的数据成员m_B2
- public:
- void Setm_B2(int x) //定义基类的成员函数Setm_B2
- {
- m_B2=x;
- }
- };
- class MultiDerived:public Base1,public Base2
- { //定义基类Base1和Base2的派生类MultiDerived
- public:
- void GetB1B2(void) //存取继承自基类Base1和Base2中的数据成员
- {
- int Result;
- Result=m_B1+m_B2;
- cout<<"m_B1+m_B2="<<Result<<endl;
- }
- };
- void main()
- {
- MultiDerived M; //定义派生类MultiDerived的对象
- M.Setm_B1(15);//调用继承自基类Base1中的成员函数Setm_B1
- M.Setm_B2(35);//调用继承自基类Base2中的成员函数Setm_B2
- M.GetB1B2(); //调用派生类中自定义的成员函数GetB1B2
- }