#ifndef
#define
#include <iostream>
using namespace std;

class A {
public:
void show() const;
void show1();
void show2() const;
int a;
int const b;
A();
};
#endif
#include "A.h"
void A::show() const {
cout << "A::show() const" << endl;
//show1();//常函数调普通函数 错
show2();//常函数调常函数

cout << "b = " << b << endl;//常函数调用常变量
cout << "a = " << a << endl;//常函数调用普通变量
}

void A::show1() {
cout << "A::show1()" << endl;
show();//普通函数调用常函数
cout << "b = " << b << endl;//普通函数调用常变量
}

void A::show2() const {
cout << "A::show2() const" << endl;
//show1();//常函数调普通函数 错
}

A::A() :b(1),a(2) {//常变量初始化列表初始化
cout << "A() :a(1)" << endl;
}
#include "A.h"

void fun() {
A a1;
a1.show();//普通函数调用常函数
}

int main() {

fun();
return 0;
}