프로그래밍/C, C++ (33) 썸네일형 리스트형 Enumerated Types - enums Enumerated Types - enumsSometimes as programmers we want to express the idea that a variable will be used for a specific purpose and should only be able to have a small number of values--for instance, a variable that stores the current direction of the wind might only need to store values corresponding to north, south, east, and west. One solution to this problem might be to use an int and some .. Class Design in C++ : Understanding Interfaces Class Design in C++Understanding InterfacesWhen you're designing a class in C++, the first thing you should decide is the public interface for the class. The public interface determines how your class will be used by other programmers (or you), and once designed and implemented it should generally stay pretty constant. You may decide to add to the interface, but once you've started using the cla.. Understanding Initialization Lists in C++ Understanding Initialization Lists in C++Understanding the Start of an Object's LifetimeIn C++, whenever an object of a class is created, its constructor is called. But that's not all--its parent class constructor is called, as are the constructors for all objects that belong to the class. By default, the constructors invoked are the default ("no-argument") constructors. Moreover, all of these c.. 레슨 20: Inheritance - Syntax Lesson 20: Inheritance - Syntax Before beginning this lesson, you should have an understanding of the idea of inheritance. If you do not, please read lesson 19. This lesson will consist of an overview of the syntax of inheritance, the use of the keywords public, private, and protected, and then an example program following to demonstrate each. The syntax to denote one class as inheriting from an.. 레슨 19: Inheritance - An Overview Lesson 19: Inheritance - An Overview The ability to use the object-oriented programming is an important feature of C++. Lesson 12 introduced the idea of the class; if you have not read it and do not know the basic details of classes, you should read it before continuing this tutorial. Inheritance is an important feature of classes; in fact, it is integral to the idea of object oriented programmi.. 레슨 18: Binary Trees in C++: Part 1 Binary Trees in C++: Part 1The binary tree is a fundamental data structure used in computer science. The binary tree is a useful data structure for rapidly storing sorted data and rapidly retrieving stored data. A binary tree is composed of parent nodes, or leaves, each of which stores data and also links to up to two other child nodes (leaves) which can be visualized spatially as below the firs.. 레슨 17: Functions with variable-length argument lists Lesson 17: Functions with variable-length argument lists Perhaps you would like to have a function that will accept any number of values and then return the average. You don't know how many arguments will be passed in to the function. One way you could make the function would be to accept a pointer to an array. Another way would be to write a function that can take any number of arguments. So yo.. 레슨 16: Recursion Lesson 16: Recursion Recursion is a programming technique that allows the programmer to express operations in terms of themselves. In C++, this takes the form of a function that calls itself. A useful way to think of recursive functions is to imagine them as a process being performed where one of the instructions is to "repeat the process". This makes it sound very similar to a loop because it r.. 이전 1 2 3 4 5 다음