c#

class vs struct struct의 사용법은 다음과 같다. // 구조체 정의 struct data { int a; char b; void foo() { ... } }; // 구조체의 변수 선언 data mydata; // 함수 호출 mydata.foo(); class의 사용법은 다음과 같다. // 클래스 정의 class obj { int a; char b; void foo() { ... } }; // 클래스의 변수 선언 obj myobj; // 함수 호출 myobj.foo(); 둘 다 똑같이 멤버 변수와 메서드를 가질 수 있다. 하지만 main함수에서 호출해보면 class는 함수 호출이 되지 않는다. 왜냐하면 class는 기본 접근 지정자(access modifier)가 private이고, str..
std::string::compare 함수 // string int compare (const string& str) const noexcept; // substrings int compare (size_t pos, size_t len, const string& str) const; int compare (size_t pos, size_t len, const string& str, size_t subpos, size_t sublen = npos) const; // c-string int compare (const char* s) const; int compare (size_t pos, size_t len, const char* s) const; // buffer int compare (size_t pos..
virtus
'c#' 태그의 글 목록