64,683
社区成员
发帖
与我相关
我的任务
分享
#include <iostream>
using namespace std;
class my_type
{
int m_a;
public:
void print(){cout << "1";}
void print() const{cout << "2";}
void print() volatile{cout << "3";}
void print() const volatile{cout << "4";}
my_type():m_a(0){}
};
int main()
{
my_type a;
const my_type b;
volatile my_type c;
const volatile my_type d;
a.print();
b.print();
c.print();
d.print();
}