Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Example program
- #include <iostream>
- #include <string.h>
- using namespace std;
- class MX {
- public:
- char numeX[90];
- MX(const char* nume=NULL){
- if (nume)
- strcpy(numeX, nume);
- else
- strcpy(numeX, "implicit");
- afisX("Constr");
- }
- virtual void afisX(const char* sir){
- cout << "MX:" << sir << "#" << numeX << endl;
- }
- short a0;
- ~MX(){
- cout << "MX:Destr"<<endl;
- }
- };
- class SX {
- static int bs;
- public:
- char numeY[90];
- short b0;
- SX ( const char *nume=NULL) {
- if ( nume)
- strcpy (numeY, nume);
- else
- strcpy(numeY, "implicit");
- afixY("Constr");
- }
- virtual void afisY(const char* sir) {
- cout << "SX:" << sir << "#" << numeY << endl;
- }
- ~SX() {
- afisY("Destr");
- }
- };
- class PX :
- private SX,
- protected MX {
- short d2;
- public:
- PX ( const char *nume=NULL ) : SX ( nume ), MX( nume ) {
- if ( nume )
- strcpy ( numeY, nume);
- else
- strcpy ( numeX, "implicit";
- afisY("Constr PX Ref:");
- }
- virtual void afisY( const char* sir){
- cout << "PX:" << sir << "#" << numeY << endl;
- }
- };
- int main() {
- SX y[3];
- {
- PX *x = new PX("X");
- if(x) delete x;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement