클래스 (2) 썸네일형 리스트형 [C++] 클래스 밖에서 정의한 맴버 변수 예제 1234567891011121314151617181920212223242526272829303132333435363738 #include using namespace std; // Point 클래스를 정의한다.class Point{public: // 멤버 변수 int x, y; // 멤버 함수 void Print();}; void Point::Print() //Point::print()에서 '::'의 역할은 'Point클래스의print함수이다' 라는 뜻으로 이해하시면 됩니다.{ cout [JAVA]인스턴스와 클래스간의 변수와 메소드 접근 가능여부 확인 예제 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950package a; class C1{ static int static_variable = 1; int instance_variable = 2; static void static_static(){ System.out.println(static_variable); } static void static_instance(){ // 클래스 메소드에서는 인스턴스 변수에 접근 할 수 없다. // System.out.println(instance_variable); } void instance_static(){ // 인스턴스 메소드에서는 클래스 변수에 접근 .. 이전 1 다음