#ifndef
#define
#include <iostream>
using namespace std;
class A {
public:
A();
A(int );
void show();
void show1() const;
int i;
const int j;
};
#endif
#include "A.h"
#include <iostream>
using namespace std;
A::A():j(1),i(2) {
cout << "A::A():j(1)" << endl;
}
A::A(int):j(2) ,i(3){
cout << "A::A(int):j(2)" << endl;
}
void A::show() {
cout << "A::show() " << endl;
}
void A::show1() const{
cout << "A::show1() const" << endl;
}
#include "A.h"
void fun() {
const A a1;//常类对象
//a1.show();//常对象调普通函数 错
a1.show1();
cout << "a1.i = " << a1.i << endl;//常对象调普通变量
cout << "a1.j = " << a1.j << endl;//常对象调常变量
}
int main() {
fun();
return 0;
}