#include<iostream.h>
//重载赋值函数 不成功
class point
{
private:
int a;
int b;
public:
point():a(3),b(4){};//无参默认构造函数
point(int m,int n):a(m),b(n){cout << "一般构造";};//一般构造函数
point(const point & p):a(p.a),b(p.b){cout << "拷贝构造";};//拷贝构造函数
point & operator =(const point & temp){a=temp.a;b=temp.b;return *this;cout << "重载赋值";}//重载赋值函数
void put(){cout<<"a="<<a<<" b="<<b<<endl;}
};
int main()
{
point p1;
point p2(10,20);
point p3=p2;
point p4(p2);
p1.put();
p2.put();
p3.put();
p4.put();
cin.get();
return 0;
}
#include<iostream.h>
class point
{
private:
int a;
int b;
public:
point():a(3),b(4){};//无参默认构造函数
point(int m,int n):a(m),b(n){};//一般构造函数
point(const point & p):a(p.a),b(p.b){};//拷贝构造函数
point & operator =(const point & temp){a=temp.a;b=temp.b;return *this;}//重载赋值函数
void put(){cout<<"a="<<a<<"b="<<b<<endl;}
};
int main()
{
point p1;
point p2(10,20);
point p3=p2;
point p4(p2);
p1.put();
p2.put();
p3.put();
p4.put();
return 0;
}
3。
The setjmp function saves a stack environment, which you can subsequently restore using longjmp. When used together, setjmp and longjmp provide a way to execute a “non-local goto.” They are typically used to pass execution control to error-handling or recovery code in a previously called routine without using the normal calling or return conventions.
A call to setjmp saves the current stack environment in env. A subsequent call to longjmp restores the saved environment and returns control to the point just after the corresponding setjmp call. All variables (except register variables) accessible to the routine receiving control contain the values they had when longjmp was called.
setjmp and longjmp do not support C++ object semantics. In C++ programs, use the C++ exception-handling mechanism.