Predict the output of following C++ program. 1 #include <iostream> 2 using namespace std; 3 4 class Base 5 { 6 public: 7 virtual void fun ( int x = 0 ) 8 { 9 cout << "Base::fun(), x = " << x << endl; 10 } 11 }; 12 13 clas…
An abstract function has to be overridden while a virtual function may be overridden. Virtual functions can have a default /generic implementation in the base class. An abstract function can have no functionality. You're basically saying, any child c…
Default arguments are a helpful feature, but there is one situation where they can be surprisingly unhelpful. Using a mutable type (like a list or dictionary) as a default argument and then modifying that argument can lead to strange results. It's us…
Default parameters for templates in C++: Like function default arguments, templates can also have default arguments. For example, in the following program, the second parameter U has the default value as char. 1 #include<iostream> 2 using namespace…
Windows 安全机制 漏洞的万源之本在于冯诺依曼设计的计算机模型没有将代码和数据进行区分——病毒.加壳脱壳.shellcode.跨站脚本攻击.SQL注入等都是因为计算机把数据和代码混淆这一天然缺陷而造成的. Windows XP SP2 之前的系统致力于系统稳定性,忽略安全性:之后的 Windows 系统系统加入了独特的安全性设计: 1. GS 编译技术:函数返回地址之前加入了 Security Cookie,返回之前首先检测 cookie 是否正确,栈溢出难度增加. 2. 增加了对 S.E…