对象的引用的变形——&t->*t
2013-04-27 18:24
99 查看
#include <iostream> using namespace std; class Time { public: Time(int,int,int); int hour; int minute; int sec; }; Time::Time(int h,int m,int s) { hour=h; minute=m; sec=s; } void fun(Time *t)//形参t是Time类对象的引用 { (*t).hour=18; } int main() { Time t1(10,13,56); fun (&t1);//实参是Time类对象,可以通过引用来修改实参t1的值;t1传的是地址 cout<<t1.hour<<" "<<t1.minute<<" "<<t1.sec<<endl;//输出的t1.hour为18 return 0; }
相关文章推荐
- List<?> list= new ArrayList<?>为什么这样写 接口引用指向实现类的对象
- axis2.AxisFault: 服务器无法处理请求。 ---> 未将对象引用设置到对象的实例。
- 降低对象的引用级别到软引用 class SoftValueMap<K, V> extends HashMap<K, V>
- getWeatherbyCityName(city),服务器无法处理请求。 ---> 未将对象引用设置到对象的实例。
- 让<未将对象引用到实例>见鬼去吧!
- 使用< OBJECT >标记引用对象
- Python入门的36个例子 之 23 -> Objects and References —— 复制引用还是复制实体对象
- 使用< OBJECT >标记引用对象
- axis2.AxisFault: 服务器无法处理请求。 ---> 未将对象引用设置到对象的实例。
- 编写一个智能指针类,自动记录SmartPointer<T*>对象的引用计数,一旦T类型对象的引用计数为零,就会释放对象
- Flex中的RemoteObject对象和<RemoteObject>标签是不可以同时存在的
- 使用easyUI的datagrid显示查询得到的List<Object>对象
- JVM Knowledges-类的 <clinit> 与 对象的<init> 对比
- std::cin>>value返回左操作数std::cin对象
- 深入理解javascript原型和闭包(1)-->一切都是对象
- 网页引用外部js脚本文件时必须是<script></script>标记格式
- 常见"未将对象引用设置到对象的实例"异常的原因
- C++ &引用对象
- ConditionalWeakTable<TKey, TValue>使编译器可以将对象字段动态附加到托管对象。
- 返回对象和返回对象的引用的区别···