제목 : 19.8. 예제. 객체 생성과 동시에 초기화 : 객체생성과동시에초기화.cpp
    
    
        
            
                | 
                    글번호:
                 | 
                
                 | 
                
                    157
                 | 
            
            
                | 
                    작성자:
                 | 
                
                 | 
                
                    
                        레드플러스
                        
                        
                    
                 | 
            
            
                | 
                    작성일:
                 | 
                
                 | 
                
                    
                        2005/08/18 오후 9:13:40 
                    
                 | 
            
            
            
                | 
                    조회수:
                 | 
                
                 | 
                
                    
                        5499
                    
                 | 
            
            
        
     
 
    
	
	
    
	#include <iostream>
using std::cout;
using std::endl;
class Car{
private:
    char* _Color;
public:
    Car(char* color) {
        _Color = color;
    }
    void Print(void) {
        cout << _Color << " 색상의 자동차 " << endl;
    }
};
void main() {
    //[1] 변수 선언과 동시에 초기화 : C언어
    int i = 10;
    //[2] 변수 선언과 동시에 초기화 : C++언어
    int j(20);
    cout << i << endl;
    cout << j << endl;
    //[3] Car 클래스의 인스턴스 생성
    Car car1("Red"); car1.Print();
    //[4] Car 클래스의 인스턴스 생성 또 다른 방법 : 묵시적인 형 변환
    Car car2 = "Blue"; car2.Print();
}