블로그
- 열혈 C++ chapter 2 - 3 참조자(Reference)의 이해 Referen.cpp 12345678910111213141516#include using namespace std; int main(){ int num1 = 1020; int & Scriptercs RefArrElem.cpp 12345678910111213141516#include using namespace std; int main(){ int arr[3
- 열혈 C++ chapter 1 - 5 이름공간(namespace)에 대한 소개 progcomimp1{ void simplefunc(void) { std::cout << "progcom이 정의한 함수" << std::endl; }} int main (){ BestComImp1::simpleFunc(); progcomimp1::simplefunc(); system("pause");} Colored by Color Scriptercs
- 열혈 C++ chapter 1-1 C언어 기반의 C++1 문자열 HelloWorld의 출력 1234567891011#include int main(){ int num = 20; std::cout << "HelloWorld" & << 'A'; std::cout << ' ' << 3.14 << std::endl; system("pause");}Colored by Color
- 열혈 C++ chapter 1 - 3 매개변수의 디폴트 값 DefaultValue1.cpp 1234567891011121314#include int Adder(int num1 = 1, int num2 = 2){ return num1 + num2;} int main << std::endl; std::cout << Adder(3, 5) << std::endl; system("pause");}Colored by Color
- 열혈 C++ chapter 1 - 4 인라인(inline) 함수 1234567891011121314151617#include inline int SQUARE(int x); int main(){ std::cout << SQUARE(5) SQUARE(12) << std::endl; system("pause");} inline int SQUARE(int x){ return x * x;} Colored by Color
- 문제 2 - 1, 2 - 2 12345678910111213141516171819202122232425262728293031#include using namespace std; int add(int &num);int change(int &num); int main pause");} int add(int &num){ return num += 1;} int change(int &num){ return -num;} Colored by Color
- 동적 메모리 할당 123456789101112131415161718192021222324252627282930313233343536#include #include int main(){ int * str "str[%d] = %d \n",i, str[i]); } printf("sum = %d \n", sum); free(str); system("pause");}Colored by Color
- 46번째 퍼즐 - 애매한 생성자 참조 | 자바 퍼즐러(도서) 46번째 퍼즐 - 애매한 생성자 두 개의 생성자가 있다 그리고 main() 메소드에서 생성자를 호출하고 있다 어떤 생성자가 호출될까? 왜 그럴까? (String[] args) { new Q46_The_Case_of_the_Confusing_Constructor(null); }}Colored by Color Scriptercs
- 54번째 퍼즐 - Null 과 Void ; } public static void main(String[] args) { ((Q54_Null_and_Void)null).greet(); }}Colored by Color Scriptercs main() 메소드에서 null 의 greet() 메소드를 호출한다 그러나 null 의 메소드는 호출할 수 없다 따라서 이번 프로그램을 실행하면 NullPinterException
- 48번째 퍼즐 - 정적 메소드 public class Q48_All_I_Get_Is_Static { public static void main(String[] args) { Dog_Q48 woofer = new System.out.println("woof "); }} class Basenji extends Dog_Q48 { public static void bark() { }}Colored by Color