$ cat main.cpp
#include<iostream>
using namespace std;
class CPU
{
public:
virtual void calculate() = 0;
};
class VideoCard
{
public:
virtual void display() = 0;
};
class Memory
{
public:
virtual void storage() = 0;
};
class Computer
{
public:
Computer(CPU* cpu, VideoCard* vc, Memory* mem)
{
m_cpu = cpu;
m_vc = vc;
m_mem = mem;
}
void work()
{
m_cpu->calculate();
m_vc->display();
m_mem->storage();
}
~Computer()
{
if (m_cpu!= NULL)
{
delete m_cpu;
m_cpu = NULL;
}
if (m_vc!= NULL)
{
delete m_vc;
m_vc = NULL;
}
if (m_mem!= NULL)
{
delete m_mem;
m_mem = NULL;
}
}
private:
CPU* m_cpu;
VideoCard* m_vc;
Memory* m_mem;
};
class IntelCPU :public CPU
{
public:
virtual void calculate()
{
cout << "Intel的CPU开始计算了!" << endl;
}
};
class IntelVideoCard :public VideoCard
{
public:
virtual void display()
{
cout << "Intel的显卡开始显示了!" << endl;
}
};
class IntelMemory :public Memory
{
public:
virtual void storage()
{
cout << "Intel的内存条开始存储了!" << endl;
}
};
class LenovoCPU :public CPU
{
public:
virtual void calculate()
{
cout << "Lenovo的CPU开始计算了!" << endl;
}
};
class LenovoVideoCard :public VideoCard
{
public:
virtual void display()
{
cout << "Lenovo的显卡开始显示了!" << endl;
}
};
class LenovoMemory :public Memory
{
public:
virtual void storage()
{
cout << "Lenovo的内存条开始存储了!" << endl;
}
};
void test01()
{
CPU* intelCpu = new IntelCPU;
VideoCard* intelCard = new IntelVideoCard;
Memory* intelMem = new IntelMemory;
cout << "第一台电脑开始工作:" << endl;
Computer* computer1 = new Computer(intelCpu, intelCard, intelMem);
computer1->work();
delete computer1;
cout << "--------------------" << endl;
cout << "第二台电脑开始工作:" << endl;
Computer* computer2 = new Computer(new LenovoCPU, new LenovoVideoCard, new LenovoMemory);
computer2->work();
delete computer2;
cout << "--------------------" << endl;
cout << "第三台电脑开始工作:" << endl;
Computer* computer3 = new Computer(new LenovoCPU, new IntelVideoCard, new LenovoMemory);
computer3->work();
delete computer3;
}
int main()
{
test01();
system("pause");
return 0;
}
$ g++ -Wall -S main.cpp
main.cpp: In destructor ‘Computer::~Computer()’:
main.cpp:56:25: warning: deleting object of abstract class type ‘CPU’ which has non-virtual destructor will cause undefined behavior [-Wdelete-non-virtual-dtor]
56 | delete m_cpu;
| ^~~~~~~~~~~~
main.cpp:62:25: warning: deleting object of abstract class type ‘VideoCard’ which has non-virtual destructor will cause undefined behavior [-Wdelete-non-virtual-dtor]
62 | delete m_vc;
| ^~~~~~~~~~~
main.cpp:68:25: warning: deleting object of abstract class type ‘Memory’ which has non-virtual destructor will cause undefined behavior [-Wdelete-non-virtual-dtor]
68 | delete m_mem;
| ^~~~~~~~~~~~
$ cat main.s
.file "main.cpp"
.text
.local _ZStL8__ioinit
.comm _ZStL8__ioinit,1,1
.section .text._ZN8ComputerC2EP3CPUP9VideoCardP6Memory,"axG",@progbits,_ZN8ComputerC5EP3CPUP9VideoCardP6Memory,comdat
.align 2
.weak _ZN8ComputerC2EP3CPUP9VideoCardP6Memory
.type _ZN8ComputerC2EP3CPUP9VideoCardP6Memory, @function
_ZN8ComputerC2EP3CPUP9VideoCardP6Memory:
.LFB1730:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
movq %rdi, -8(%rbp)
movq %rsi, -16(%rbp)
movq %rdx, -24(%rbp)
movq %rcx, -32(%rbp)
movq -8(%rbp), %rax
movq -16(%rbp), %rdx
movq %rdx, (%rax)
movq -8(%rbp), %rax
movq -24(%rbp), %rdx
movq %rdx, 8(%rax)
movq -8(%rbp), %rax
movq -32(%rbp), %rdx
movq %rdx, 16(%rax)
nop
popq %rbp
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE1730:
.size _ZN8ComputerC2EP3CPUP9VideoCardP6Memory, .-_ZN8ComputerC2EP3CPUP9VideoCardP6Memory
.weak _ZN8ComputerC1EP3CPUP9VideoCardP6Memory
.set _ZN8ComputerC1EP3CPUP9VideoCardP6Memory,_ZN8ComputerC2EP3CPUP9VideoCardP6Memory
.section .text._ZN8Computer4workEv,"axG",@progbits,_ZN8Computer4workEv,comdat
.align 2
.weak _ZN8Computer4workEv
.type _ZN8Computer4workEv, @function
_ZN8Computer4workEv:
.LFB1732:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
subq $16, %rsp
movq %rdi, -8(%rbp)
movq -8(%rbp), %rax
movq (%rax), %rax
movq (%rax), %rax
movq (%rax), %rdx
movq -8(%rbp), %rax
movq (%rax), %rax
movq %rax, %rdi
call *%rdx
movq -8(%rbp), %rax
movq 8(%rax), %rax
movq (%rax), %rax
movq (%rax), %rdx
movq -8(%rbp), %rax
movq 8(%rax), %rax
movq %rax, %rdi
call *%rdx
movq -8(%rbp), %rax
movq 16(%rax), %rax
movq (%rax), %rax
movq (%rax), %rdx
movq -8(%rbp), %rax
movq 16(%rax), %rax
movq %rax, %rdi
call *%rdx
nop
leave
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE1732:
.size _ZN8Computer4workEv, .-_ZN8Computer4workEv
.section .text._ZN8ComputerD2Ev,"axG",@progbits,_ZN8ComputerD5Ev,comdat
.align 2
.weak _ZN8ComputerD2Ev
.type _ZN8ComputerD2Ev, @function
_ZN8ComputerD2Ev:
.LFB1734:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
subq $16, %rsp
movq %rdi, -8(%rbp)
movq -8(%rbp), %rax
movq (%rax), %rax
testq %rax, %rax
je .L4
movq -8(%rbp), %rax
movq (%rax), %rax
testq %rax, %rax
je .L5
movl $8, %esi
movq %rax, %rdi
call _ZdlPvm@PLT
.L5:
movq -8(%rbp), %rax
movq $0, (%rax)
.L4:
movq -8(%rbp), %rax
movq 8(%rax), %rax
testq %rax, %rax
je .L6
movq -8(%rbp), %rax
movq 8(%rax), %rax
testq %rax, %rax
je .L7
movl $8, %esi
movq %rax, %rdi
call _ZdlPvm@PLT
.L7:
movq -8(%rbp), %rax
movq $0, 8(%rax)
.L6:
movq -8(%rbp), %rax
movq 16(%rax), %rax
testq %rax, %rax
je .L10
movq -8(%rbp), %rax
movq 16(%rax), %rax
testq %rax, %rax
je .L9
movl $8, %esi
movq %rax, %rdi
call _ZdlPvm@PLT
.L9:
movq -8(%rbp), %rax
movq $0, 16(%rax)
.L10:
nop
leave
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE1734:
.size _ZN8ComputerD2Ev, .-_ZN8ComputerD2Ev
.weak _ZN8ComputerD1Ev
.set _ZN8ComputerD1Ev,_ZN8ComputerD2Ev
.section .rodata
.LC0:
.string "Intel\347\232\204CPU\345\274\200\345\247\213\350\256\241\347\256\227\344\272\206\357\274\201"
.section .text._ZN8IntelCPU9calculateEv,"axG",@progbits,_ZN8IntelCPU9calculateEv,comdat
.align 2
.weak _ZN8IntelCPU9calculateEv
.type _ZN8IntelCPU9calculateEv, @function
_ZN8IntelCPU9calculateEv:
.LFB1736:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
subq $16, %rsp
movq %rdi, -8(%rbp)
leaq .LC0(%rip), %rax
movq %rax, %rsi
leaq _ZSt4cout(%rip), %rax
movq %rax, %rdi
call _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
movq _ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rdx
movq %rdx, %rsi
movq %rax, %rdi
call _ZNSolsEPFRSoS_E@PLT
nop
leave
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE1736:
.size _ZN8IntelCPU9calculateEv, .-_ZN8IntelCPU9calculateEv
.section .rodata
.align 8
.LC1:
.string "Intel\347\232\204\346\230\276\345\215\241\345\274\200\345\247\213\346\230\276\347\244\272\344\272\206\357\274\201"
.section .text._ZN14IntelVideoCard7displayEv,"axG",@progbits,_ZN14IntelVideoCard7displayEv,comdat
.align 2
.weak _ZN14IntelVideoCard7displayEv
.type _ZN14IntelVideoCard7displayEv, @function
_ZN14IntelVideoCard7displayEv:
.LFB1737:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
subq $16, %rsp
movq %rdi, -8(%rbp)
leaq .LC1(%rip), %rax
movq %rax, %rsi
leaq _ZSt4cout(%rip), %rax
movq %rax, %rdi
call _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
movq _ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rdx
movq %rdx, %rsi
movq %rax, %rdi
call _ZNSolsEPFRSoS_E@PLT
nop
leave
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE1737:
.size _ZN14IntelVideoCard7displayEv, .-_ZN14IntelVideoCard7displayEv
.section .rodata
.align 8
.LC2:
.string "Intel\347\232\204\345\206\205\345\255\230\346\235\241\345\274\200\345\247\213\345\255\230\345\202\250\344\272\206\357\274\201"
.section .text._ZN11IntelMemory7storageEv,"axG",@progbits,_ZN11IntelMemory7storageEv,comdat
.align 2
.weak _ZN11IntelMemory7storageEv
.type _ZN11IntelMemory7storageEv, @function
_ZN11IntelMemory7storageEv:
.LFB1738:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
subq $16, %rsp
movq %rdi, -8(%rbp)
leaq .LC2(%rip), %rax
movq %rax, %rsi
leaq _ZSt4cout(%rip), %rax
movq %rax, %rdi
call _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
movq _ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rdx
movq %rdx, %rsi
movq %rax, %rdi
call _ZNSolsEPFRSoS_E@PLT
nop
leave
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE1738:
.size _ZN11IntelMemory7storageEv, .-_ZN11IntelMemory7storageEv
.section .rodata
.align 8
.LC3:
.string "Lenovo\347\232\204CPU\345\274\200\345\247\213\350\256\241\347\256\227\344\272\206\357\274\201"
.section .text._ZN9LenovoCPU9calculateEv,"axG",@progbits,_ZN9LenovoCPU9calculateEv,comdat
.align 2
.weak _ZN9LenovoCPU9calculateEv
.type _ZN9LenovoCPU9calculateEv, @function
_ZN9LenovoCPU9calculateEv:
.LFB1739:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
subq $16, %rsp
movq %rdi, -8(%rbp)
leaq .LC3(%rip), %rax
movq %rax, %rsi
leaq _ZSt4cout(%rip), %rax
movq %rax, %rdi
call _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
movq _ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rdx
movq %rdx, %rsi
movq %rax, %rdi
call _ZNSolsEPFRSoS_E@PLT
nop
leave
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE1739:
.size _ZN9LenovoCPU9calculateEv, .-_ZN9LenovoCPU9calculateEv
.section .rodata
.align 8
.LC4:
.string "Lenovo\347\232\204\346\230\276\345\215\241\345\274\200\345\247\213\346\230\276\347\244\272\344\272\206\357\274\201"
.section .text._ZN15LenovoVideoCard7displayEv,"axG",@progbits,_ZN15LenovoVideoCard7displayEv,comdat
.align 2
.weak _ZN15LenovoVideoCard7displayEv
.type _ZN15LenovoVideoCard7displayEv, @function
_ZN15LenovoVideoCard7displayEv:
.LFB1740:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
subq $16, %rsp
movq %rdi, -8(%rbp)
leaq .LC4(%rip), %rax
movq %rax, %rsi
leaq _ZSt4cout(%rip), %rax
movq %rax, %rdi
call _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
movq _ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rdx
movq %rdx, %rsi
movq %rax, %rdi
call _ZNSolsEPFRSoS_E@PLT
nop
leave
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE1740:
.size _ZN15LenovoVideoCard7displayEv, .-_ZN15LenovoVideoCard7displayEv
.section .rodata
.align 8
.LC5:
.string "Lenovo\347\232\204\345\206\205\345\255\230\346\235\241\345\274\200\345\247\213\345\255\230\345\202\250\344\272\206\357\274\201"
.section .text._ZN12LenovoMemory7storageEv,"axG",@progbits,_ZN12LenovoMemory7storageEv,comdat
.align 2
.weak _ZN12LenovoMemory7storageEv
.type _ZN12LenovoMemory7storageEv, @function
_ZN12LenovoMemory7storageEv:
.LFB1741:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
subq $16, %rsp
movq %rdi, -8(%rbp)
leaq .LC5(%rip), %rax
movq %rax, %rsi
leaq _ZSt4cout(%rip), %rax
movq %rax, %rdi
call _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
movq _ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rdx
movq %rdx, %rsi
movq %rax, %rdi
call _ZNSolsEPFRSoS_E@PLT
nop
leave
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE1741:
.size _ZN12LenovoMemory7storageEv, .-_ZN12LenovoMemory7storageEv
.section .text._ZN3CPUC2Ev,"axG",@progbits,_ZN3CPUC5Ev,comdat
.align 2
.weak _ZN3CPUC2Ev
.type _ZN3CPUC2Ev, @function
_ZN3CPUC2Ev:
.LFB1745:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
movq %rdi, -8(%rbp)
leaq 16+_ZTV3CPU(%rip), %rdx
movq -8(%rbp), %rax
movq %rdx, (%rax)
nop
popq %rbp
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE1745:
.size _ZN3CPUC2Ev, .-_ZN3CPUC2Ev
.weak _ZN3CPUC1Ev
.set _ZN3CPUC1Ev,_ZN3CPUC2Ev
.section .text._ZN8IntelCPUC2Ev,"axG",@progbits,_ZN8IntelCPUC5Ev,comdat
.align 2
.weak _ZN8IntelCPUC2Ev
.type _ZN8IntelCPUC2Ev, @function
_ZN8IntelCPUC2Ev:
.LFB1747:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
subq $16, %rsp
movq %rdi, -8(%rbp)
movq -8(%rbp), %rax
movq %rax, %rdi
call _ZN3CPUC2Ev
leaq 16+_ZTV8IntelCPU(%rip), %rdx
movq -8(%rbp), %rax
movq %rdx, (%rax)
nop
leave
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE1747:
.size _ZN8IntelCPUC2Ev, .-_ZN8IntelCPUC2Ev
.weak _ZN8IntelCPUC1Ev
.set _ZN8IntelCPUC1Ev,_ZN8IntelCPUC2Ev
.section .text._ZN9VideoCardC2Ev,"axG",@progbits,_ZN9VideoCardC5Ev,comdat
.align 2
.weak _ZN9VideoCardC2Ev
.type _ZN9VideoCardC2Ev, @function
_ZN9VideoCardC2Ev:
.LFB1751:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
movq %rdi, -8(%rbp)
leaq 16+_ZTV9VideoCard(%rip), %rdx
movq -8(%rbp), %rax
movq %rdx, (%rax)
nop
popq %rbp
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE1751:
.size _ZN9VideoCardC2Ev, .-_ZN9VideoCardC2Ev
.weak _ZN9VideoCardC1Ev
.set _ZN9VideoCardC1Ev,_ZN9VideoCardC2Ev
.section .text._ZN14IntelVideoCardC2Ev,"axG",@progbits,_ZN14IntelVideoCardC5Ev,comdat
.align 2
.weak _ZN14IntelVideoCardC2Ev
.type _ZN14IntelVideoCardC2Ev, @function
_ZN14IntelVideoCardC2Ev:
.LFB1753:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
subq $16, %rsp
movq %rdi, -8(%rbp)
movq -8(%rbp), %rax
movq %rax, %rdi
call _ZN9VideoCardC2Ev
leaq 16+_ZTV14IntelVideoCard(%rip), %rdx
movq -8(%rbp), %rax
movq %rdx, (%rax)
nop
leave
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE1753:
.size _ZN14IntelVideoCardC2Ev, .-_ZN14IntelVideoCardC2Ev
.weak _ZN14IntelVideoCardC1Ev
.set _ZN14IntelVideoCardC1Ev,_ZN14IntelVideoCardC2Ev
.section .text._ZN6MemoryC2Ev,"axG",@progbits,_ZN6MemoryC5Ev,comdat
.align 2
.weak _ZN6MemoryC2Ev
.type _ZN6MemoryC2Ev, @function
_ZN6MemoryC2Ev:
.LFB1757:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
movq %rdi, -8(%rbp)
leaq 16+_ZTV6Memory(%rip), %rdx
movq -8(%rbp), %rax
movq %rdx, (%rax)
nop
popq %rbp
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE1757:
.size _ZN6MemoryC2Ev, .-_ZN6MemoryC2Ev
.weak _ZN6MemoryC1Ev
.set _ZN6MemoryC1Ev,_ZN6MemoryC2Ev
.section .text._ZN11IntelMemoryC2Ev,"axG",@progbits,_ZN11IntelMemoryC5Ev,comdat
.align 2
.weak _ZN11IntelMemoryC2Ev
.type _ZN11IntelMemoryC2Ev, @function
_ZN11IntelMemoryC2Ev:
.LFB1759:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
subq $16, %rsp
movq %rdi, -8(%rbp)
movq -8(%rbp), %rax
movq %rax, %rdi
call _ZN6MemoryC2Ev
leaq 16+_ZTV11IntelMemory(%rip), %rdx
movq -8(%rbp), %rax
movq %rdx, (%rax)
nop
leave
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE1759:
.size _ZN11IntelMemoryC2Ev, .-_ZN11IntelMemoryC2Ev
.weak _ZN11IntelMemoryC1Ev
.set _ZN11IntelMemoryC1Ev,_ZN11IntelMemoryC2Ev
.section .text._ZN9LenovoCPUC2Ev,"axG",@progbits,_ZN9LenovoCPUC5Ev,comdat
.align 2
.weak _ZN9LenovoCPUC2Ev
.type _ZN9LenovoCPUC2Ev, @function
_ZN9LenovoCPUC2Ev:
.LFB1762:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
subq $16, %rsp
movq %rdi, -8(%rbp)
movq -8(%rbp), %rax
movq %rax, %rdi
call _ZN3CPUC2Ev
leaq 16+_ZTV9LenovoCPU(%rip), %rdx
movq -8(%rbp), %rax
movq %rdx, (%rax)
nop
leave
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE1762:
.size _ZN9LenovoCPUC2Ev, .-_ZN9LenovoCPUC2Ev
.weak _ZN9LenovoCPUC1Ev
.set _ZN9LenovoCPUC1Ev,_ZN9LenovoCPUC2Ev
.section .text._ZN15LenovoVideoCardC2Ev,"axG",@progbits,_ZN15LenovoVideoCardC5Ev,comdat
.align 2
.weak _ZN15LenovoVideoCardC2Ev
.type _ZN15LenovoVideoCardC2Ev, @function
_ZN15LenovoVideoCardC2Ev:
.LFB1765:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
subq $16, %rsp
movq %rdi, -8(%rbp)
movq -8(%rbp), %rax
movq %rax, %rdi
call _ZN9VideoCardC2Ev
leaq 16+_ZTV15LenovoVideoCard(%rip), %rdx
movq -8(%rbp), %rax
movq %rdx, (%rax)
nop
leave
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE1765:
.size _ZN15LenovoVideoCardC2Ev, .-_ZN15LenovoVideoCardC2Ev
.weak _ZN15LenovoVideoCardC1Ev
.set _ZN15LenovoVideoCardC1Ev,_ZN15LenovoVideoCardC2Ev
.section .text._ZN12LenovoMemoryC2Ev,"axG",@progbits,_ZN12LenovoMemoryC5Ev,comdat
.align 2
.weak _ZN12LenovoMemoryC2Ev
.type _ZN12LenovoMemoryC2Ev, @function
_ZN12LenovoMemoryC2Ev:
.LFB1768:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
subq $16, %rsp
movq %rdi, -8(%rbp)
movq -8(%rbp), %rax
movq %rax, %rdi
call _ZN6MemoryC2Ev
leaq 16+_ZTV12LenovoMemory(%rip), %rdx
movq -8(%rbp), %rax
movq %rdx, (%rax)
nop
leave
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE1768:
.size _ZN12LenovoMemoryC2Ev, .-_ZN12LenovoMemoryC2Ev
.weak _ZN12LenovoMemoryC1Ev
.set _ZN12LenovoMemoryC1Ev,_ZN12LenovoMemoryC2Ev
.section .rodata
.LC6:
.string "\347\254\254\344\270\200\345\217\260\347\224\265\350\204\221\345\274\200\345\247\213\345\267\245\344\275\234:"
.LC7:
.string "--------------------"
.LC8:
.string "\347\254\254\344\272\214\345\217\260\347\224\265\350\204\221\345\274\200\345\247\213\345\267\245\344\275\234:"
.LC9:
.string "\347\254\254\344\270\211\345\217\260\347\224\265\350\204\221\345\274\200\345\247\213\345\267\245\344\275\234:"
.text
.globl _Z6test01v
.type _Z6test01v, @function
_Z6test01v:
.LFB1742:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $48, %rsp
.cfi_offset 14, -24
.cfi_offset 13, -32
.cfi_offset 12, -40
.cfi_offset 3, -48
movl $8, %edi
call _Znwm@PLT
movq %rax, %rbx
movq %rbx, %rdi
call _ZN8IntelCPUC1Ev
movq %rbx, -80(%rbp)
movl $8, %edi
call _Znwm@PLT
movq %rax, %rbx
movq %rbx, %rdi
call _ZN14IntelVideoCardC1Ev
movq %rbx, -72(%rbp)
movl $8, %edi
call _Znwm@PLT
movq %rax, %rbx
movq %rbx, %rdi
call _ZN11IntelMemoryC1Ev
movq %rbx, -64(%rbp)
leaq .LC6(%rip), %rax
movq %rax, %rsi
leaq _ZSt4cout(%rip), %rax
movq %rax, %rdi
call _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
movq _ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rdx
movq %rdx, %rsi
movq %rax, %rdi
call _ZNSolsEPFRSoS_E@PLT
movl $24, %edi
call _Znwm@PLT
movq %rax, %rbx
movq -64(%rbp), %rcx
movq -72(%rbp), %rdx
movq -80(%rbp), %rax
movq %rax, %rsi
movq %rbx, %rdi
call _ZN8ComputerC1EP3CPUP9VideoCardP6Memory
movq %rbx, -56(%rbp)
movq -56(%rbp), %rax
movq %rax, %rdi
call _ZN8Computer4workEv
movq -56(%rbp), %rbx
testq %rbx, %rbx
je .L27
movq %rbx, %rdi
call _ZN8ComputerD1Ev
movl $24, %esi
movq %rbx, %rdi
call _ZdlPvm@PLT
.L27:
leaq .LC7(%rip), %rax
movq %rax, %rsi
leaq _ZSt4cout(%rip), %rax
movq %rax, %rdi
call _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
movq _ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rdx
movq %rdx, %rsi
movq %rax, %rdi
call _ZNSolsEPFRSoS_E@PLT
leaq .LC8(%rip), %rax
movq %rax, %rsi
leaq _ZSt4cout(%rip), %rax
movq %rax, %rdi
call _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
movq _ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rdx
movq %rdx, %rsi
movq %rax, %rdi
call _ZNSolsEPFRSoS_E@PLT
movl $8, %edi
call _Znwm@PLT
movq %rax, %rbx
movq %rbx, %rdi
call _ZN9LenovoCPUC1Ev
movl $8, %edi
call _Znwm@PLT
movq %rax, %r12
movq %r12, %rdi
call _ZN15LenovoVideoCardC1Ev
movl $8, %edi
call _Znwm@PLT
movq %rax, %r13
movq %r13, %rdi
call _ZN12LenovoMemoryC1Ev
movl $24, %edi
call _Znwm@PLT
movq %rax, %r14
movq %r13, %rcx
movq %r12, %rdx
movq %rbx, %rsi
movq %r14, %rdi
call _ZN8ComputerC1EP3CPUP9VideoCardP6Memory
movq %r14, -48(%rbp)
movq -48(%rbp), %rax
movq %rax, %rdi
call _ZN8Computer4workEv
movq -48(%rbp), %rbx
testq %rbx, %rbx
je .L28
movq %rbx, %rdi
call _ZN8ComputerD1Ev
movl $24, %esi
movq %rbx, %rdi
call _ZdlPvm@PLT
.L28:
leaq .LC7(%rip), %rax
movq %rax, %rsi
leaq _ZSt4cout(%rip), %rax
movq %rax, %rdi
call _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
movq _ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rdx
movq %rdx, %rsi
movq %rax, %rdi
call _ZNSolsEPFRSoS_E@PLT
leaq .LC9(%rip), %rax
movq %rax, %rsi
leaq _ZSt4cout(%rip), %rax
movq %rax, %rdi
call _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
movq _ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rdx
movq %rdx, %rsi
movq %rax, %rdi
call _ZNSolsEPFRSoS_E@PLT
movl $8, %edi
call _Znwm@PLT
movq %rax, %rbx
movq %rbx, %rdi
call _ZN9LenovoCPUC1Ev
movl $8, %edi
call _Znwm@PLT
movq %rax, %r12
movq %r12, %rdi
call _ZN14IntelVideoCardC1Ev
movl $8, %edi
call _Znwm@PLT
movq %rax, %r13
movq %r13, %rdi
call _ZN12LenovoMemoryC1Ev
movl $24, %edi
call _Znwm@PLT
movq %rax, %r14
movq %r13, %rcx
movq %r12, %rdx
movq %rbx, %rsi
movq %r14, %rdi
call _ZN8ComputerC1EP3CPUP9VideoCardP6Memory
movq %r14, -40(%rbp)
movq -40(%rbp), %rax
movq %rax, %rdi
call _ZN8Computer4workEv
movq -40(%rbp), %rbx
testq %rbx, %rbx
je .L30
movq %rbx, %rdi
call _ZN8ComputerD1Ev
movl $24, %esi
movq %rbx, %rdi
call _ZdlPvm@PLT
.L30:
nop
addq $48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %rbp
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE1742:
.size _Z6test01v, .-_Z6test01v
.section .rodata
.LC10:
.string "pause"
.text
.globl main
.type main, @function
main:
.LFB1770:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
call _Z6test01v
leaq .LC10(%rip), %rax
movq %rax, %rdi
call system@PLT
movl $0, %eax
popq %rbp
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE1770:
.size main, .-main
.weak _ZTV12LenovoMemory
.section .data.rel.ro.local._ZTV12LenovoMemory,"awG",@progbits,_ZTV12LenovoMemory,comdat
.align 8
.type _ZTV12LenovoMemory, @object
.size _ZTV12LenovoMemory, 24
_ZTV12LenovoMemory:
.quad 0
.quad _ZTI12LenovoMemory
.quad _ZN12LenovoMemory7storageEv
.weak _ZTV15LenovoVideoCard
.section .data.rel.ro.local._ZTV15LenovoVideoCard,"awG",@progbits,_ZTV15LenovoVideoCard,comdat
.align 8
.type _ZTV15LenovoVideoCard, @object
.size _ZTV15LenovoVideoCard, 24
_ZTV15LenovoVideoCard:
.quad 0
.quad _ZTI15LenovoVideoCard
.quad _ZN15LenovoVideoCard7displayEv
.weak _ZTV9LenovoCPU
.section .data.rel.ro.local._ZTV9LenovoCPU,"awG",@progbits,_ZTV9LenovoCPU,comdat
.align 8
.type _ZTV9LenovoCPU, @object
.size _ZTV9LenovoCPU, 24
_ZTV9LenovoCPU:
.quad 0
.quad _ZTI9LenovoCPU
.quad _ZN9LenovoCPU9calculateEv
.weak _ZTV11IntelMemory
.section .data.rel.ro.local._ZTV11IntelMemory,"awG",@progbits,_ZTV11IntelMemory,comdat
.align 8
.type _ZTV11IntelMemory, @object
.size _ZTV11IntelMemory, 24
_ZTV11IntelMemory:
.quad 0
.quad _ZTI11IntelMemory
.quad _ZN11IntelMemory7storageEv
.weak _ZTV14IntelVideoCard
.section .data.rel.ro.local._ZTV14IntelVideoCard,"awG",@progbits,_ZTV14IntelVideoCard,comdat
.align 8
.type _ZTV14IntelVideoCard, @object
.size _ZTV14IntelVideoCard, 24
_ZTV14IntelVideoCard:
.quad 0
.quad _ZTI14IntelVideoCard
.quad _ZN14IntelVideoCard7displayEv
.weak _ZTV8IntelCPU
.section .data.rel.ro.local._ZTV8IntelCPU,"awG",@progbits,_ZTV8IntelCPU,comdat
.align 8
.type _ZTV8IntelCPU, @object
.size _ZTV8IntelCPU, 24
_ZTV8IntelCPU:
.quad 0
.quad _ZTI8IntelCPU
.quad _ZN8IntelCPU9calculateEv
.weak _ZTV6Memory
.section .data.rel.ro._ZTV6Memory,"awG",@progbits,_ZTV6Memory,comdat
.align 8
.type _ZTV6Memory, @object
.size _ZTV6Memory, 24
_ZTV6Memory:
.quad 0
.quad _ZTI6Memory
.quad __cxa_pure_virtual
.weak _ZTV9VideoCard
.section .data.rel.ro._ZTV9VideoCard,"awG",@progbits,_ZTV9VideoCard,comdat
.align 8
.type _ZTV9VideoCard, @object
.size _ZTV9VideoCard, 24
_ZTV9VideoCard:
.quad 0
.quad _ZTI9VideoCard
.quad __cxa_pure_virtual
.weak _ZTV3CPU
.section .data.rel.ro._ZTV3CPU,"awG",@progbits,_ZTV3CPU,comdat
.align 8
.type _ZTV3CPU, @object
.size _ZTV3CPU, 24
_ZTV3CPU:
.quad 0
.quad _ZTI3CPU
.quad __cxa_pure_virtual
.weak _ZTI12LenovoMemory
.section .data.rel.ro._ZTI12LenovoMemory,"awG",@progbits,_ZTI12LenovoMemory,comdat
.align 8
.type _ZTI12LenovoMemory, @object
.size _ZTI12LenovoMemory, 24
_ZTI12LenovoMemory:
.quad _ZTVN10__cxxabiv120__si_class_type_infoE+16
.quad _ZTS12LenovoMemory
.quad _ZTI6Memory
.weak _ZTS12LenovoMemory
.section .rodata._ZTS12LenovoMemory,"aG",@progbits,_ZTS12LenovoMemory,comdat
.align 8
.type _ZTS12LenovoMemory, @object
.size _ZTS12LenovoMemory, 15
_ZTS12LenovoMemory:
.string "12LenovoMemory"
.weak _ZTI15LenovoVideoCard
.section .data.rel.ro._ZTI15LenovoVideoCard,"awG",@progbits,_ZTI15LenovoVideoCard,comdat
.align 8
.type _ZTI15LenovoVideoCard, @object
.size _ZTI15LenovoVideoCard, 24
_ZTI15LenovoVideoCard:
.quad _ZTVN10__cxxabiv120__si_class_type_infoE+16
.quad _ZTS15LenovoVideoCard
.quad _ZTI9VideoCard
.weak _ZTS15LenovoVideoCard
.section .rodata._ZTS15LenovoVideoCard,"aG",@progbits,_ZTS15LenovoVideoCard,comdat
.align 16
.type _ZTS15LenovoVideoCard, @object
.size _ZTS15LenovoVideoCard, 18
_ZTS15LenovoVideoCard:
.string "15LenovoVideoCard"
.weak _ZTI9LenovoCPU
.section .data.rel.ro._ZTI9LenovoCPU,"awG",@progbits,_ZTI9LenovoCPU,comdat
.align 8
.type _ZTI9LenovoCPU, @object
.size _ZTI9LenovoCPU, 24
_ZTI9LenovoCPU:
.quad _ZTVN10__cxxabiv120__si_class_type_infoE+16
.quad _ZTS9LenovoCPU
.quad _ZTI3CPU
.weak _ZTS9LenovoCPU
.section .rodata._ZTS9LenovoCPU,"aG",@progbits,_ZTS9LenovoCPU,comdat
.align 8
.type _ZTS9LenovoCPU, @object
.size _ZTS9LenovoCPU, 11
_ZTS9LenovoCPU:
.string "9LenovoCPU"
.weak _ZTI11IntelMemory
.section .data.rel.ro._ZTI11IntelMemory,"awG",@progbits,_ZTI11IntelMemory,comdat
.align 8
.type _ZTI11IntelMemory, @object
.size _ZTI11IntelMemory, 24
_ZTI11IntelMemory:
.quad _ZTVN10__cxxabiv120__si_class_type_infoE+16
.quad _ZTS11IntelMemory
.quad _ZTI6Memory
.weak _ZTS11IntelMemory
.section .rodata._ZTS11IntelMemory,"aG",@progbits,_ZTS11IntelMemory,comdat
.align 8
.type _ZTS11IntelMemory, @object
.size _ZTS11IntelMemory, 14
_ZTS11IntelMemory:
.string "11IntelMemory"
.weak _ZTI14IntelVideoCard
.section .data.rel.ro._ZTI14IntelVideoCard,"awG",@progbits,_ZTI14IntelVideoCard,comdat
.align 8
.type _ZTI14IntelVideoCard, @object
.size _ZTI14IntelVideoCard, 24
_ZTI14IntelVideoCard:
.quad _ZTVN10__cxxabiv120__si_class_type_infoE+16
.quad _ZTS14IntelVideoCard
.quad _ZTI9VideoCard
.weak _ZTS14IntelVideoCard
.section .rodata._ZTS14IntelVideoCard,"aG",@progbits,_ZTS14IntelVideoCard,comdat
.align 16
.type _ZTS14IntelVideoCard, @object
.size _ZTS14IntelVideoCard, 17
_ZTS14IntelVideoCard:
.string "14IntelVideoCard"
.weak _ZTI8IntelCPU
.section .data.rel.ro._ZTI8IntelCPU,"awG",@progbits,_ZTI8IntelCPU,comdat
.align 8
.type _ZTI8IntelCPU, @object
.size _ZTI8IntelCPU, 24
_ZTI8IntelCPU:
.quad _ZTVN10__cxxabiv120__si_class_type_infoE+16
.quad _ZTS8IntelCPU
.quad _ZTI3CPU
.weak _ZTS8IntelCPU
.section .rodata._ZTS8IntelCPU,"aG",@progbits,_ZTS8IntelCPU,comdat
.align 8
.type _ZTS8IntelCPU, @object
.size _ZTS8IntelCPU, 10
_ZTS8IntelCPU:
.string "8IntelCPU"
.weak _ZTI6Memory
.section .data.rel.ro._ZTI6Memory,"awG",@progbits,_ZTI6Memory,comdat
.align 8
.type _ZTI6Memory, @object
.size _ZTI6Memory, 16
_ZTI6Memory:
.quad _ZTVN10__cxxabiv117__class_type_infoE+16
.quad _ZTS6Memory
.weak _ZTS6Memory
.section .rodata._ZTS6Memory,"aG",@progbits,_ZTS6Memory,comdat
.align 8
.type _ZTS6Memory, @object
.size _ZTS6Memory, 8
_ZTS6Memory:
.string "6Memory"
.weak _ZTI9VideoCard
.section .data.rel.ro._ZTI9VideoCard,"awG",@progbits,_ZTI9VideoCard,comdat
.align 8
.type _ZTI9VideoCard, @object
.size _ZTI9VideoCard, 16
_ZTI9VideoCard:
.quad _ZTVN10__cxxabiv117__class_type_infoE+16
.quad _ZTS9VideoCard
.weak _ZTS9VideoCard
.section .rodata._ZTS9VideoCard,"aG",@progbits,_ZTS9VideoCard,comdat
.align 8
.type _ZTS9VideoCard, @object
.size _ZTS9VideoCard, 11
_ZTS9VideoCard:
.string "9VideoCard"
.weak _ZTI3CPU
.section .data.rel.ro._ZTI3CPU,"awG",@progbits,_ZTI3CPU,comdat
.align 8
.type _ZTI3CPU, @object
.size _ZTI3CPU, 16
_ZTI3CPU:
.quad _ZTVN10__cxxabiv117__class_type_infoE+16
.quad _ZTS3CPU
.weak _ZTS3CPU
.section .rodata._ZTS3CPU,"aG",@progbits,_ZTS3CPU,comdat
.type _ZTS3CPU, @object
.size _ZTS3CPU, 5
_ZTS3CPU:
.string "3CPU"
.text
.type _Z41__static_initialization_and_destruction_0ii, @function
_Z41__static_initialization_and_destruction_0ii:
.LFB2273:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
subq $16, %rsp
movl %edi, -4(%rbp)
movl %esi, -8(%rbp)
cmpl $1, -4(%rbp)
jne .L35
cmpl $65535, -8(%rbp)
jne .L35
leaq _ZStL8__ioinit(%rip), %rax
movq %rax, %rdi
call _ZNSt8ios_base4InitC1Ev@PLT
leaq __dso_handle(%rip), %rax
movq %rax, %rdx
leaq _ZStL8__ioinit(%rip), %rax
movq %rax, %rsi
movq _ZNSt8ios_base4InitD1Ev@GOTPCREL(%rip), %rax
movq %rax, %rdi
call __cxa_atexit@PLT
.L35:
nop
leave
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE2273:
.size _Z41__static_initialization_and_destruction_0ii, .-_Z41__static_initialization_and_destruction_0ii
.type _GLOBAL__sub_I__Z6test01v, @function
_GLOBAL__sub_I__Z6test01v:
.LFB2274:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
movl $65535, %esi
movl $1, %edi
call _Z41__static_initialization_and_destruction_0ii
popq %rbp
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE2274:
.size _GLOBAL__sub_I__Z6test01v, .-_GLOBAL__sub_I__Z6test01v
.section .init_array,"aw"
.align 8
.quad _GLOBAL__sub_I__Z6test01v
.weak __cxa_pure_virtual
.hidden __dso_handle
.ident "GCC: (GNU) 11.1.0"
.section .note.GNU-stack,"",@progbits
$