ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • 클래스안의 멤버함수들의 사용법
    카테고리 없음 2013. 2. 20. 02:13
    반응형

    #include<iostream>

    using namespace std;

    class Myclass
    {
    public : 
    void showprint();
    void showprint(char *s);
    void showprint(char *s,int n);
    };

    void Myclass::showprint()
    {
    showprint("1 안녕..",1);

    }


    void Myclass::showprint(char*s)
    {
    showprint(s,2);
    }
    void Myclass::showprint(char*s,int n)
    {
    for (int i=0;i<n;i++)
    {
    cout<<s<<endl;
    }
    }


    int main(void)
    {
    Myclass my;

    my.showprint();
    my.showprint("2상진월드");
    my.showprint("3상진월드",3);



    return 0;
    }

    반응형
Designed by Tistory.