内嵌类&this指针使用
来源:互联网 发布:淘宝上门自提 编辑:程序博客网 时间:2024/05/21 19:47
- #include <iostream>
- #include <string>
- using namespace std;
- class home{
- public:
- class Car : public string
- {
- friend class home;
- public:
- Car(const char* name, int num):string(name){ sits = num; cout<<"Car::this="<<*this<<"/n"; }
- int sits;
- static Car* NewCar(const char* name, int num)
- {
- return new Car(name, num);
- }
- void setSits(int b){sits = b;}
- };
- Car* pCar;
- public:
- void BuyCar(const char* name, int sits){ pCar = Car::NewCar(name, sits);}
- home(){ pCar = NULL; }
- ~home(){ if(pCar) delete pCar; pCar = NULL; }
- };
- int main()
- {
- home hh;
- hh.BuyCar("宝马", 4);
- return 0;
- }
内嵌类和this指针和好处,这是是个实例
- 内嵌类&this指针使用
- this指针的使用
- 什么时候使用this 指针
- this指针的使用
- this 指针的使用
- this指针的使用
- C++ this指针的使用
- Java this指针的使用
- this指针的使用js
- 【c++】this指针的使用
- this指针的详细说明与使用
- JavaScript中的this指针使用汇总
- C++ 父类使用的this指针
- C++大学基础教程_10_5_使用this指针
- C++中的this 指针的使用
- C++中this指针的使用
- javascript this 指针的使用及常见问题
- this指针的概念和使用
- 将vs2008 项目 转换成到2005 下的解决方案
- Delphi菜单中没有的快捷键
- ENVI和ERDAS中自定义坐标系的方法(转载)
- Hibernate之中inverse与cascade的异同
- 如果shell里面的date不能满足需要的话,用perl吧
- 内嵌类&this指针使用
- 13783 Power manage
- 经纬度坐标与高斯坐标的转换代码
- Java 调用word
- 字句
- PMIC Battery Driver
- 靖国神社主页被中国黑客篡改——小饭,Beach,RichMan,s4t4n
- 做售前技术支持工作的心得
- mfc combo box 控件使用方法总结