본문 바로가기

프로그램언어/C++

[c++] template Class Suppose that you are writing a C++ program that requires two stacks--one for integer data and one for string data. You could implement these classes as follows. The implementation below isn't very good (it limits the stack to 1000 elements and it does no error checking), but it will serve as an example. class IntStack {public: IntStack() { top = -1; } void push(int i) { st[++top] = i; } int pop(.. 더보기
[C++] template C++ Class Templates are used where we have multiple copies of code for different data types with the same logic. If a set of functions or classes have the same functionality for different data types, they becomes good candidates for being written as Templates. One good area where this C++ Class Templates are suited can be container classes. Very famous examples for these container classes will b.. 더보기
IRC 프로토콜의 이해 기본 프로토콜에 대한 이해는 다음 출처에서 정보를 얻을 수 있다. http://ttongfly.net/zbxe/?document_srl=45549 더보기
gdb을 이용한 디버깅. 리눅스 프로그래밍을 하면서 kdeveloper 및 eclipse 기타 응용툴이 더 있을 것이다. K는 자체 콘솔창에 의한 디버깅에 상당히 유용하다. 내가 필요한 정보를 보기에도 상당히 편하다는 장점을 가지고 있다. eclipse는 프로그램에 필요한 플러그인 및 기타 응용툴에서 탁월한 기능을 가지고 있어 실제 프로그래밍을 할때 너무 유용하였다. 하지만 k처럼 콘솔창에 디버깅 또는 ui에서 디버깅 할 때 약간의 불편함이 있다. ( 뭐 편하다고 하는 분들도 물론 있지만, 가끔 죽는 버그가 있다. 자바버전에 대한 문제라고 하는 분들도 있고, 정확히 뭐라 딱 찝어서 말하기는 ... 쩝 ) 여기서 디버깅하는 것은 eclipse 기반으로 정의 해볼까 한다. 뭐 지금 사용하고 있으니깐..^-^;; 툴에서 하는 디버깅하.. 더보기
[ Project Frame Work ] 다음과 같이 작업을 하기 위해 text 정의 !! 개발모델 시스템 환경. * OS : SUSE 11.0 64bit * RAM : 4G * TOOL : eclipse main 에서 시작으로 기본 Frame을 만든다. 1. 기본 틀을 구성한다. 2. 초기화를 담당한다. #0001 정의 3. 리소스를 되돌려주는 역할을 한다. #0001 정의 * thread을 구성한다. * 초기화 / JOIN / STOP 으로 정의한다. #0002 정의 * 외부로부터 환경파일을 읽어들이는 모듈을 구성한다. * DB Conn을 구성한다. * 기타모듈을 구성 [ 기획성 모듈 구성 ] #0003 정의 * 필요한 라이브러리 구성한다. * 로그 모듈. * 파일 읽기/쓰기 모듈. * DB와 연결 모듈. * 암호화 모듈. * 기타모듈 구성 [ 필요한 모듈 추가 ] 더보기
C++ Operator Overloading Guidelines C++ Operator Overloading Guidelines One of the nice features of C++ is that you can give special meanings to operators, when they are used with user-defined classes. This is called operator overloading. You can implement C++ operator overloads by providing special member-functions on your classes that follow a particular naming convention. For example, to overload the + operator for your class, .. 더보기
[C++] 참조자와 포인터 ( reference & pointer ) reference & pointer 모두 다른 객체를 간접적으로 참조 할 수 있습니다. 하지만 두 가지 방법을 구분하는 이유가 무엇일까? 라는데에서부터 시작할까 합니다. 참조자 개념부터 설명을 드리면 "NULL reference"란 것이 없다고 생각하시면 됩니다. 참조자는 어떤 경우든지 메모리 공간을 차지한 객체를 참조하고 있어야 합니다. 따라서 메모리에 접근하기 위해서는 변수를 통해 데이터를 조작하게 됩니다. 하지만 접근하는 변수가 없을 경우 포인터를 사용해야 합니다. 왜냐하면, 이런 경우에는 포인터의 값을 널(NULL)로 세팅할 수 있기 때문입니다.( 포인터을 잘못써서 데이터가 들어가야 될 자리에 널이 들어가면 서버가 죽는 경우를 허다하게 보았기 때문에 잘 사용하셔야 됩니다.) 객체를 참조하는 어떤 .. 더보기
[ STL ] vector Reference vector class template Vector Vectors are a kind of sequence containers. As such, their elements are ordered following a strict linear sequence. Vector containers are implemented as dynamic arrays; Just as regular arrays, vector containers have their elements stored in contiguous storage locations, which means that their elements can be accessed not only using iterators but also using offsets on .. 더보기