Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ConsoleApplication19.cpp : This file contains the 'main' function. Program execution begins and ends there.
- //
- #include "pch.h"
- #include <iostream>
- using namespace std;
- /*int main()
- {
- cout<<"Hello World";
- return 0;
- }*/
- class A {
- public:
- virtual int fun() {
- cout << "A"; return 0;
- }
- int fun1() {
- return fun();
- }
- ~A() {
- fun();
- }
- };
- class B : public A {
- public:
- int fun() {
- cout << "B"; return 0;
- }
- int fun2() {
- return fun();
- }
- };
- char abecadlo[] = "przeintelektualizowany";
- class Y {
- public:
- static int nn;
- Y() {
- cout << abecadlo[nn % 20] << "~";
- }
- Y(int nn) {
- Y::nn += nn;
- }
- virtual ~Y() {
- nn--;
- }
- };
- class X : public Y{
- int n;
- X *p;
- Y q;
- public:
- X(int nn) : n(nn),p(0),q(nn) {
- if (n % 2)
- p = new X(n - 1);
- cout << abecadlo[(n + nn) % 10];
- }
- ~X() {
- cout << nn;
- if (p) delete p;
- }
- };
- int Y::nn = 107416;
- int main() {
- Y* x = new X(5);
- delete x;
- B* b = new B;
- b->fun1();
- b->fun2();
- delete b;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement