Virtual Inheritance
Virtual Inheritance시 발생가능한 문제점
#include <iostream>
class Animal {
public:
virtual void speak();
virtual ~Animal() = default;
private:
double animalData;
}
class Lion : public Animal {
public:
Lion() {
std::cout << "Lion Consturctor" << std::endl;
}
virtual void speak() {
std::cout &l...
Multiple Inheritance
#include <iostream>
class Lion {
public:
Lion() {
std::cout << "Lion Consturctor" << std::endl;
}
virtual void speak() {
std::cout << "Lion!" << std::endl;
}
virtual ~Lion() {
std::cout << "Lion Desturctor" << std::endl;
}
private:
double lionData;...
Inheritance
Base Class Destructor
상속을 사용하는데 있어서 Base class의 Destructor는 무조건 virtual public / protected 로 사용
#include <iostream>
class Animal {
public:
Animal() {
std::cout << "Animal constructor" << std::endl;
}
virtual ~Animal() { // VIRTUAL PUBLIC
std::cout << "Animal Destructor" << std::en...
Confusing Term
constexpr
컴파일 타임에 변수의 값을 알 수 있으면 constexpr 사용 (좋은 설명)
constexpr int a = 10;
constexpr int b = 5;
// constexpr이 붙은 함수는 컴파일러가 직접 컴파일 시간에 모든 값을 미리 계산한다
constexpr int fibonacci(const int n) {
if (n <= 1) return n;
return fibonacci(n - 1) + fibonacci(n - 2);
}
default
class MyClass {
public:
MyClass() = ...
Basics
Value Type
L-Value: 나중에 다시 부를 수 있는 변수 (Callable)
R-Value: 한번 쓰고 다시 안쓰는 변수 (Temporary)
std::string a = "abc"; # L = R
std::string b = a # L = L
파라미터 해석
파라미터로 &가 오면 L-Value, &&가 오면 R-Value
L-Value는 copy sementic
R-Value는 move sementic
void push_back( const T& value )
void push_back( T&...
Group
·
Group (G)
A group G, denoted by { G, + } such that (a, b) of elements in G an element (a + b) in G × G
Following axioms are obeyed:
Closure under addition: If a and b belong to G, then a + b is also in G
Associative of addition: a + (b + c) = (a + b) + c for all a, b, c in G
Identity element: There is an element e in G such that a ...
Basics
Terminology
Common Divisor 공약수
Common Multiple 공배수
Prime Number 소수
Least[Lowest] Common Multiple 최소 공배수
Greatest Common Divisor 최대 공약수
Identity element 항등원
Inverse element 역원
Operating rules of real numbers
Commutative property 교환 법칙
Associative property 결합 법칙
Distributive property 분배 법칙
Greatest...
Binary Search Tree
A Binary Search Tree (BST) is a node-based binary tree data structure which has the following properties:
The left subtree of a node contains only nodes with keys lesser than the node’s key.
The right subtree of a node contains only nodes with keys greater than the node’s key.
The left and right subtree each must also be a binary search ...
10 post articles, 2 pages.