๐Ÿ““ ์‹œ์ž‘ํ•˜๋ฉฐ

2019๋…„ ๊ตญ๋ฏผ๋Œ€ํ•™๊ต SW๊ฒจ์šธ์บ ํ”„์— ์ฐธ๊ฐ€ํ•˜๋ฉด์„œ ๋ธ”๋ก์ฒด์ธ์— ๋Œ€ํ•ด ์•Œ๊ฒŒ ๋˜๊ณ  solidity๋ผ๋Š” ์–ธ์–ด๋ฅผ ๊ณต๋ถ€ํ•˜์˜€์Šต๋‹ˆ๋‹ค.
๊ทธ ์ด์ „์—๋„ SCTF์˜ ๋ฌธ์ œ์—์„œ๋„ ๋ณธ ์ ์ด ์žˆ์ง€๋งŒ ๊ทธ ๋•Œ๋Š” ์ž˜ ์•Œ์ง€ ๋ชป ํ–ˆ์—ˆ์Šต๋‹ˆ๋‹ค.
์ด๋ฒˆ์— ๊ฐœ์ธ์ ์œผ๋กœ ํฌ๋ฆฝํ† ์ข€๋น„๋ฅผ ํ†ตํ•ด ๋ฌธ๋ฒ•์„ ์ตํžˆ๋˜ ๋„์ค‘ ์ƒ์†์— ๋Œ€ํ•œ ํ‚ค์›Œ๋“œ๋กœ
is๋ฅผ ์‚ฌ์šฉํ•˜๊ณ  ์žˆ๋Š” ๊ฒƒ์„ ๋ฐœ๊ฒฌํ•˜๊ณ ์„  ์ €๋Š” ์ƒ๊ฐ์— ๋น ์กŒ์Šต๋‹ˆ๋‹ค.
์ผ๋ฐ˜์ ์œผ๋กœ ์‚ฌ๋žŒ๋“ค์ด ์ดํ•ดํ•˜๊ธฐ์— is๊ฐ€ ์ƒ์†์œผ๋กœ ์ดํ•ด๋  ์ˆ˜ ์žˆ๋Š”๊ฐ€๋ฅผ ์ƒ๊ฐํ•˜๋ฉฐ ๊ทธ ๋ณธ ๋œป์„ ์•Œ์•„๋ณด๊ณ ์ž ํ•˜์˜€์Šต๋‹ˆ๋‹ค.

๐Ÿค” ์†”๋ฆฌ๋””ํ‹ฐ?

์†”๋ฆฌ๋””ํ‹ฐ๋Š” ๊ฐ„๋žตํžˆ ๋งํ•˜๋ฉด ๋‹ค์Œ๊ณผ ๊ฐ™์Šต๋‹ˆ๋‹ค

Ethereum Virtual Machine (EVM)์—์„œ ์‚ฌ์šฉํ•˜๊ธฐ ์œ„ํ•ด ์„ค๊ณ„๋œ ์ •์ ํƒ€์ž… ๊ณ„์•ฝ ์ง€ํ–ฅ ํ”„๋กœ๊ทธ๋ž˜๋ฐ ์–ธ์–ด
๋ธ”๋ก์ฒด์ธ ํ”Œ๋žซํผ ์ƒ์—์„œ ์Šค๋งˆํŠธ๊ณ„์•ฝ(Smart Contract)๋ฅผ ์ž‘์„ฑํ•˜๊ธฐ ์œ„ํ•ด ์‚ฌ์šฉ๋œ๋‹ค.

ํ˜„์žฌ๋Š” ์ด๋”๋ฆฌ์›€์˜ ์ฃผ์š” ์–ธ์–ด๋กœ ์‚ฌ์šฉ๋˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค.
์•„๋ž˜๋Š” ๊ฐ„๋‹จํ•œ ์†”๋ฆฌ๋””ํ‹ฐ ์ฝ”๋“œ์ž…๋‹ˆ๋‹ค.

pragma solidity ^0.4.24;

contract Main {
    function getHelloWorld() public pure returns(string) {
        return "Hello World!!";
    }
}

๐Ÿ˜ต ๋„์™€์ค˜์š” SOF

์‹œ๊ฐ„์ด ํ˜๋Ÿฌ ๊ฒฐ๊ตญ์—๋Š” Stack Overflow์— ๋„์›€์„ ์š”์ฒญํ–ˆ์Šต๋‹ˆ๋‹ค!

๊ทธ๋ž˜์„œ ๋‹ค์Œ๊ณผ ๊ฐ™์€ ๋‹ต๋ณ€์„ ๋“ค์„ ์ˆ˜ ์žˆ์—ˆ์Šต๋‹ˆ๋‹ค.

Because in proper object oriented designs, inheritance really should be an "is a" relationship, so why not? - ShadowRanger

๊ฐ์ฒด์ง€ํ–ฅ ํ”„๋กœ๊ทธ๋ž˜๋ฐ์–ธ์–ด์˜ ์žฅ์ ์€ ์ฝ”๋“œ์˜ ์žฌํ™œ์šฉ์ž…๋‹ˆ๋‹ค. ๊ทธ์— ๋Œ€ํ•œ ๋ฐฉ๋ฒ•์œผ๋กœ ํฌ๊ฒŒ ์ƒ์†๊ณผ ์ปดํฌ์ง€์…˜(์กฐํ•ฉ)์ด ์žˆ์Šต๋‹ˆ๋‹ค. ์ƒ์†์„ ๊ธฐ๋ฐ˜์œผ๋กœ ํ•œ ๊ฒƒ์„ IS-A ๊ด€๊ณ„๋ผ ํ•˜๊ณ  ์กฐํ•ฉ์„ HAS-A ๊ด€๊ณ„๋ผ ํ•ฉ๋‹ˆ๋‹ค.

๐Ÿ•ถ ๊ฒฐ๋ก 

Solidity์—์„œ์˜ is๊ฐ€ ์ƒ์†์„ ์˜๋ฏธํ•˜๋Š” ์ด์œ ๋Š” IS-A Relationship์—์„œ์˜ IS๋ฅผ ์˜๋ฏธํ•˜๊ธฐ ๋•Œ๋ฌธ์ž…๋‹ˆ๋‹ค.
๊ณ ๋กœ is๋Š” ์ •์ƒ์ ์ธ ์˜๋ฏธ๋ฅผ ๊ฐ€์ง„ ํ‚ค์›Œ๋“œ์˜€์Šต๋‹ˆ๋‹ค!

// ๊ฐœ์ธ์ ์œผ๋กœ๋Š” extends๊ฐ€ ๋” ๋งˆ์Œ์— ๋“ญ๋‹ˆ๋‹ค.. :(

๐Ÿ“” ์ฐธ๊ณ ์ž๋ฃŒ