#include <iostream.h>
class A
{
unsigned char var;
public:
A(unsigned char x){
var=x:
}
void print(){
cout<<″var=″<<var;
}
};
void main()
{
A a(″x″) ;
a. print ();
}
A A("X"); 类的对象A在定义时的参数不能是字符串“X”,而应该是字符‘X’。
#include <iostream.h>
class A
{
unsigned char var;
public:
A(unsigned char x){
var=x:
}
void print(){
cout<<″var=″<<var;
}
};
void main()
{
A a(″x″) ;
a. print ();
}
#include <iostream.h>
class A
{
unsigned char var;
public:
A(unsigned char x){
var=x:
}
void print(){
cout<<″var=″<<var;
}
};
void main()
{
A a(″x″) ;
a. print ();
}
A A("X"); 类的对象A在定义时的参数不能是字符串“X”,而应该是字符‘X’。