#include <stdio.h>
struct A {
private:
int no;
protected:
char ch;
public:
int sum;
void Sub(int n, char c);
void Func(void);
};
void A::Sub(int n, char c)
{
if(n%2==0) n++;
no = n;
if(c >='a' && c<='z') c-=32;
ch = c;
}
void A::Func(void)
{
printf("%d\t%c\n", no, ch);
}
void main(void)
{
A aa;
printf("%d\n", sizeof(aa));
//aa.SetNo(5);
//aa.no = 5;
//aa.ch='A';
aa.sum=100;
aa.Sub(4, 'a');
aa.Func();
}
struct에 private, protected, public을 쓸 수 있다.
댓글 없음:
댓글 쓰기
국정원의 댓글 공작을 지탄합니다.