C, C++

[C++] ์ƒ์†(Inheritance)

๋ฒผ๋ฆฌ01 2024. 8. 29. 09:29

๐Ÿ“Œ์ƒ์†

์ฝ”๋“œ์˜ ์ค‘๋ณต์„ ์ค„์ด๊ณ  ์žฌ์‚ฌ์šฉ์„ฑ์„ ๋†’์ด๊ธฐ ์œ„ํ•ด ํด๋ž˜์Šค ๊ฐ„์˜ ์ƒ์† ๊ด€๊ณ„๋ฅผ ์ •์˜ํ•  ์ˆ˜ ์žˆ๋‹ค.

์˜ˆ๋ฅผ ๋“ค์–ด `name`๊ณผ `address`๋ฅผ ๊ฐ–๋Š” `RagularEmployee`์™€ `TemporaryEmployee`๊ฐ€ ์žˆ์„ ๋•Œ, ๋‘˜์„ ` Employee`๋กœ ์ผ๋ฐ˜ํ™”ํ•˜์—ฌ ์ •์˜ํ•˜๊ณ  ์ƒ์†๋ฐ›์•„ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋‹ค.

 

 

#include <iostream>

using namespace std;

class Employee {

public : 
	Employee() {

	}

	Employee(const char* name, const char* address) {
		this->name = new char[strlen(name) + 1];
		this->address = new char[strlen(address) + 1];

		strcpy_s(this->name, strlen(name) + 1, name);
		strcpy_s(this->address, strlen(address) + 1, address);
	}

	~Employee() {
		delete[] name;
		delete[] address;
	}

	char* getName() {
		return this->name;
	}

	char* getAddress() {
		return this->address;
	}

	void print() {
		cout << "์ด๋ฆ„: " << this->getName() << ", ์ฃผ์†Œ: " << this-> getAddress() << endl;
	}

protected:
	char* name;
	char* address;
};

 

class RegularEmployee : public Employee {

private :
	int ์—ฐ๋ด‰;

};

class TemporaryEmployee : public Employee {

private :
	int ์ฃผ๊ธ‰;
};

 

 

 

๋‘˜์€ ํด๋ž˜์Šค ๋‚ด๋ถ€์— ๋˜ ๋‹ค์‹œ ์†์„ฑ์„ ์ •์˜ํ•˜์ง€ ์•Š๋”๋ผ๋„ ์ƒ์†์„ ๋ฐ›์•˜๊ธฐ ๋•Œ๋ฌธ์— ์ด๋ฆ„๊ณผ ์ฃผ์†Œ๋ฅผ ๊ฐ€์ง„๋‹ค. ๋ฉค๋ฒ„ ํ•จ์ˆ˜๋„ ํ•จ๊ป˜ ์ƒ์†๋ฐ›์œผ๋ฏ€๋กœ `getter()` ์™€ `print()` ๋„ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋‹ค.

์ด๋•Œ `private` ์œผ๋กœ ์„ ์–ธ๋œ ๋ฉค๋ฒ„ ๋ณ€์ˆ˜๋Š” ์ƒ์†์ด ๋˜๋”๋ผ๋„ ์ ‘๊ทผ ์ œํ•œ์„ ๋ฐ›๊ธฐ ๋•Œ๋ฌธ์—, ๋งŒ์•ฝ ์ž์‹์—๊ฒŒ ์ ‘๊ทผ ๊ถŒํ•œ์„ ์ฃผ๊ณ  ์‹ถ๋‹ค๋ฉด `protected` ๋กœ ์„ค์ •ํ•ด์•ผํ•œ๋‹ค.

 

๊ฐ์ฒด ์ƒ์„ฑ ์‹œ์—๋Š” ๋ฌด์กฐ๊ฑด ๋ถ€๋ชจ์˜ ์ƒ์„ฑ์ž๋ฅผ ๋จผ์ € ํ˜ธ์ถœํ•œ๋‹ค.(๋ถ€๋ชจ๊ฐ€ ์กด์žฌํ•˜๋Š”์ง€ ํ™•์ธํ•œ ํ›„ ๋ถ€๋ชจ๋ฅผ ๋จผ์ € ๋งŒ๋“ค๊ธฐ ๋•Œ๋ฌธ์ด๋‹ค.) ๋ถ€๋ชจ์˜ ์–ด๋–ค ์ƒ์„ฑ์ž๋ฅผ ํ˜ธ์ถœํ• ์ง€ ๋ช…์‹œํ•˜์ง€ ์•Š์œผ๋ฉด ๋ฌด์กฐ๊ฑด ๊ธฐ๋ณธ ์ƒ์„ฑ์ž๋ฅผ ํ˜ธ์ถœํ•œ๋‹ค.

์›ํ•˜๋Š” ๋ถ€๋ชจ์˜ ์ƒ์„ฑ์ž๋ฅผ ์‚ฌ์šฉํ•˜๊ธฐ ์œ„ํ•ด์„œ๋Š” ๋ถ€๋ชจ์˜ ์ƒ์„ฑ์ž ์ค‘ ์–ด๋–ค ์ƒ์„ฑ์ž๋ฅผ ํ˜ธ์ถœํ• ์ง€ ์ƒ์„ฑ์ž์˜ ์‹œ๊ทธ๋‹ˆ์ฒ˜์— ๋ช…์‹œํ•ด์•ผํ•œ๋‹ค.

 

 

๊ฐ์ฒด๊ฐ€ ์Šคํƒ์— ์ƒ์„ฑ๋˜๊ธฐ ๋•Œ๋ฌธ์—, ํ•˜์œ„ ํด๋ž˜์Šค๊ฐ€ ๋จผ์ € ์†Œ๋ฉธ๋˜๊ณ  ์ƒ์œ„ ํด๋ž˜์Šค๊ฐ€ ์†Œ๋ฉธ๋œ๋‹ค. ์ด๋•Œ ์ž์‹ ํด๋ž˜์Šค์˜ ์†Œ๋ฉธ์ž๋ฅผ ๋จผ์ € ํ˜ธ์ถœํ•˜๊ณ , ๋ถ€๋ชจ ํด๋ž˜์Šค์˜ ์†Œ๋ฉธ์ž๋ฅผ ํ˜ธ์ถœํ•œ๋‹ค.

 

class RegularEmployee : public Employee {

public : 

	RegularEmployee() {
		cout << "reg ๋””ํดํŠธ ์ƒ์„ฑ์ž " << endl;
	}

	RegularEmployee(const char* name, const char* address, double salary) 
	: Employee(name, address) {
		cout << "reg ์ธ์ž ์„ธ๊ฐœ ์ƒ์„ฑ์ž " << endl;
		
		this->salary = salary;
	}

	~RegularEmployee() {
		cout << "rag ์†Œ๋ฉธ์ž ํ˜ธ์ถœ" << endl;
	}

	double PayCheck() {
		return this->salary;
	}

private :
	double salary;

};

 

void main() {

	Employee e("ํšŒ์‚ฌ์›", "ํšŒ์‚ฌ์› ์ฃผ์†Œ");
	e.print();

	RegularEmployee re("์ •๊ทœ์ง์›", "์ •๊ทœ์ง์› ์ฃผ์†Œ", 5500);
	cout << re.PayChack() << endl;

	TemporaryEmployee te("๊ณ„์•ฝ์ง", "๊ณ„์•ฝ์ง ์ฃผ์†Œ", 10, 20);
	cout << te.PayCheck() << endl;
}

 

emp ์ธ์ž ๋‘๊ฐœ ์ƒ์„ฑ์ž
์ด๋ฆ„: ํšŒ์‚ฌ์›, ์ฃผ์†Œ: ํšŒ์‚ฌ์› ์ฃผ์†Œ
emp ์ธ์ž ๋‘๊ฐœ ์ƒ์„ฑ์ž
reg ์ธ์ž ์„ธ๊ฐœ ์ƒ์„ฑ์ž
5500
emp ์ธ์ž ๋‘๊ฐœ ์ƒ์„ฑ์ž
temp ์ธ์ž ์„ธ๊ฐœ ์ƒ์„ฑ์ž
2400
temp ์†Œ๋ฉธ์ž ํ˜ธ์ถœ
emp ์†Œ๋ฉธ์ž ํ˜ธ์ถœ
rag ์†Œ๋ฉธ์ž ํ˜ธ์ถœ
emp ์†Œ๋ฉธ์ž ํ˜ธ์ถœ
emp ์†Œ๋ฉธ์ž ํ˜ธ์ถœ

 

 

๐Ÿ“Œ๋‹คํ˜•์„ฑ(Polymorphism)

์‚ฌ์ „: ๊ฐ™์€ ์ข…์˜ ์ƒ๋ฌผ์ด๋ฉด์„œ๋„ ์–ด๋–ค ํ˜•ํƒœ๋‚˜ ์„ฑ์งˆ์ด ๋‹ค์–‘ํ•˜๊ฒŒ ๋‚˜ํƒ€๋‚˜๋Š” ํ˜„์ƒ. 'poly(๋งŽ์€)' ๊ณผ 'morphism(ํ˜•ํƒœ)'์˜ ํ•ฉ์„ฑ์–ด.

ํ•˜๋‚˜์˜ ๊ฐ์ฒด๋ฅผ ๋‹ค๋ฅธ ์ž๋ฃŒํ˜•์˜ ๋ณ€์ˆ˜๋กœ ์ฐธ์กฐํ•˜์—ฌ ๋‹ค์–‘ํ•œ ๊ฒฐ๊ณผ๋ฅผ ์–ป์–ด๋‚ผ ์ˆ˜ ์žˆ๋Š” ์„ฑ์งˆ. ํด๋ž˜์Šค๊ฐ€ ์ƒ์† ๊ด€๊ณ„์— ์žˆ์„ ๋•Œ ๋‚˜ํƒ€๋‚˜๋Š” ๋‹ค์ฑ„๋กœ์šด ์„ฑ์งˆ์„ ๋งํ•œ๋‹ค.

 

๋™์  ๊ฒฐํ•ฉ/๋™์  ๋ฐ”์ธ๋”ฉ(Dynamic Binding)

์‹คํ–‰ ๋„์ค‘์— ๊ฒฐํ•ฉ(๋ฐ”์ธ๋”ฉ)์ด ์ด๋ฃจ์–ด์ง€๋Š” ๊ฒƒ์„ ๋™์  ๊ฒฐํ•ฉ์ด๋ผ๊ณ  ํ•œ๋‹ค. ๋™์  ๋ฐ”์ธ๋”ฉ์œผ๋กœ ์ธํ•ด ํฌ์ธํ„ฐ๊ฐ€ ์–ด๋–ค ํƒ€์ž…์ด๋“  ์ƒ๊ด€ ์—†์ด ๊ทธ ์‹ค์ œ ๊ฐ์ฒด๋ฅผ ๊ธฐ์ค€์œผ๋กœ ํ•จ์ˆ˜๋ฅผ ํ˜ธ์ถœํ•œ๋‹ค. ์ด ๋™์  ๋ฐ”์ธ๋”ฉ ๋•๋ถ„์— ๋‹คํ˜•์„ฑ์ด ์ ์šฉ๋˜๋Š” ๊ฒƒ!

 

 

๐Ÿ“Œ์˜ค๋ฒ„๋ผ์ด๋”ฉ(Overriding)

์‚ฌ์ „์  ์˜๋ฏธ: '~์— ๋ฎ์–ด์“ฐ๋‹ค.', '~์— ์šฐ์„ ํ•œ๋‹ค.' 

๋ถ€๋ชจ ํด๋ž˜์Šค๋กœ๋ถ€ํ„ฐ ์ƒ์† ๋ฐ›์€ ๋ฉค๋ฒ„ ํ•จ์ˆ˜๋ฅผ ์ž์‹ ํด๋ž˜์Šค์—์„œ ์žฌ์ •์˜ํ•˜์—ฌ ์ƒˆ๋กœ์šด, ๋˜๋Š” ์ˆ˜์ • ๋ฐ ํ™•์žฅ๋œ ๊ธฐ๋Šฅ์„ ๋งŒ๋“œ๋Š” ๊ฒƒ. ํ•จ์ˆ˜์˜ ์‹œ๊ทธ๋‹ˆ์ฒ˜๊ฐ€ ๋™์ผํ•ด์•ผํ•œ๋‹ค. (์ด๋ฆ„ ๋™์ผ, ๋งค๊ฐœ๋ณ€์ˆ˜์˜ ํƒ€์ž… ๋ฐ ๊ฐœ์ˆ˜ ๋™์ผ, ๋ฐ˜ํ™˜ ํƒ€์ž… ๋™์ผ)

 

๋ถ€๋ชจ ํด๋ž˜์Šค์˜ ๊ฐ์ฒด ํฌ์ธํ„ฐ๋Š” ์ž์‹ ํด๋ž˜์Šค ๊ฐ์ฒด์— ์ ‘๊ทผ์ด ๊ฐ€๋Šฅํ•˜๋‹ค. ์ฆ‰, ๋ถ€๋ชจ ํƒ€์ž…์œผ๋กœ ์„ ์–ธ๋œ ํฌ์ธํ„ฐ๋กœ ์ž์‹ ํƒ€์ž…์˜ ๊ฐ์ฒด๋ฅผ ๋‹ค๋ฃฐ ์ˆ˜ ์žˆ๋‹ค. 

 

 

๐Ÿ“Œ๊ฐ€์ƒ ํ•จ์ˆ˜(Virtual Function)

๋‹คํ˜•์„ฑ์„ ์ง€์›ํ•˜๊ธฐ ์œ„ํ•ด ์ž์‹ ํด๋ž˜์Šค์˜ ๊ฐ์ฒด๊ฐ€ ์žฌ์ •์˜ํ•œ ํ•จ์ˆ˜๋กœ ๋™์ž‘ํ•  ์ˆ˜ ์žˆ๋„๋ก ํ•˜๋Š” ๊ฒƒ. C++์—์„œ๋Š” ํ•จ์ˆ˜๋ฅผ ๊ฐ€์ƒํ•จ์ˆ˜๋กœ ๋“ฑ๋กํ•˜์ง€ ์•Š์œผ๋ฉด ์ž์‹ ๊ฐ์ฒด์—์„œ ํ•จ์ˆ˜๋ฅผ ์˜ค๋ฒ„๋ผ์ด๋”ฉ ํ–ˆ๋”๋ผ๋„, ๋ถ€๋ชจ ํƒ€์ž…์˜ ๋ณ€์ˆ˜๋กœ ์ž์‹ ๊ฐ์ฒด๋ฅผ ์ฐธ์กฐํ–ˆ์„ ๋•Œ ๋ถ€๋ชจ ํƒ€์ž…์— ์ •์˜๋œ ํ•จ์ˆ˜๋กœ ๋™์ž‘ํ•œ๋‹ค.

 

๊ฐ€์ƒ ํ•จ์ˆ˜๊ฐ€ ํฌํ•จ๋œ ํด๋ž˜์Šค๋Š” ์ถ”์ƒ ํด๋ž˜์Šค๋กœ ๊ฐ์ฒด๋ฅผ ์ƒ์„ฑํ•  ์ˆ˜ ์—†๋‹ค. 

์ž๋ฐ”์—์„œ๋Š” ๋ชจ๋“  ํ•จ์ˆ˜๊ฐ€ ๊ฐ€์ƒํ•จ์ˆ˜๋กœ ์„ ์–ธ๋˜์–ด ์žˆ๊ธฐ ๋•Œ๋ฌธ์—, ๋ถ€๋ชจ ํƒ€์ž…์˜ ๋ณ€์ˆ˜๋กœ ์ž์‹ ํƒ€์ž…์˜ ๊ฐ์ฒด๋ฅผ ์ฐธ์กฐํ•˜๋”๋ผ๋„ ์ž์‹ ๊ฐ์ฒด์—์„œ ์žฌ์ •์˜๋œ ํ•จ์ˆ˜๋กœ ๋™์ž‘ํ•œ๋‹ค.

 

๊ฐ€์ƒํ•จ์ˆ˜ ๋ฏธ์‚ฌ์šฉ

#include <iostream>

class Base {
public:
    void display() {  // ๋น„๊ฐ€์ƒ ํ•จ์ˆ˜
        std::cout << "Base display" << std::endl;
    }
};

class Derived : public Base {
public:
    void display() {  // ํ•จ์ˆ˜ ์žฌ์ •์˜ (์˜ค๋ฒ„๋ผ์ด๋”ฉ์ด ์•„๋‹˜)
        std::cout << "Derived display" << std::endl;
    }
};

int main() {
    Base* basePtr = new Derived();  // ๋ถ€๋ชจ ํƒ€์ž… ํฌ์ธํ„ฐ๋กœ ์ž์‹ ๊ฐ์ฒด ์ฐธ์กฐ
    basePtr->display();  // Base์˜ display ํ˜ธ์ถœ
    delete basePtr;
    return 0;
}

 

 

 

 

๊ฐ€์ƒํ•จ์ˆ˜ ์‚ฌ์šฉ

#include <iostream>

class Base {
public:
    virtual void display() {
        std::cout << "Base display" << std::endl;
    }
};

class Derived : public Base {
public:
    void display() override {  // ๊ฐ€์ƒ ํ•จ์ˆ˜ ์žฌ์ •์˜
        std::cout << "Derived display" << std::endl;
    }
};

int main() {
    Base* basePtr = new Derived();  // ๋ถ€๋ชจ ํƒ€์ž… ํฌ์ธํ„ฐ๋กœ ์ž์‹ ๊ฐ์ฒด ์ฐธ์กฐ
    basePtr->display();  // Derived์˜ display ํ˜ธ์ถœ
    delete basePtr;
    return 0;
}

 

 

 

 

 

C#์—์„œ์˜ ๊ฐ€์ƒํ•จ์ˆ˜

๊ฐ€์ƒํ•จ์ˆ˜ ๋ฏธ์‚ฌ์šฉ

using System;

class Base
{
    public void Display()  // ๋น„๊ฐ€์ƒ ๋ฉ”์„œ๋“œ
    {
        Console.WriteLine("Base display");
    }
}

class Derived : Base
{
    public new void Display()  // ๋ฉ”์„œ๋“œ ์ˆจ๊ธฐ๊ธฐ
    {
        Console.WriteLine("Derived display");
    }
}

class Program
{
    static void Main()
    {
        Base baseRef = new Derived();  // ๋ถ€๋ชจ ํƒ€์ž… ์ฐธ์กฐ๋กœ ์ž์‹ ๊ฐ์ฒด ์ฐธ์กฐ
        baseRef.Display();  // Base์˜ Display ํ˜ธ์ถœ
    }
}

 

 

 

 

๊ฐ€์ƒํ•จ์ˆ˜ ์‚ฌ์šฉ

using System;

class Base
{
    public virtual void Display()  // ๊ฐ€์ƒ ๋ฉ”์„œ๋“œ๋กœ ๋ณ€๊ฒฝ
    {
        Console.WriteLine("Base display");
    }
}

class Derived : Base
{
    public override void Display()  // ์žฌ์ •์˜๋œ ๊ฐ€์ƒ ๋ฉ”์„œ๋“œ
    {
        Console.WriteLine("Derived display");
    }
}

class Program
{
    static void Main()
    {
        Base baseRef = new Derived();  // ๋ถ€๋ชจ ํƒ€์ž… ์ฐธ์กฐ๋กœ ์ž์‹ ๊ฐ์ฒด ์ฐธ์กฐ
        baseRef.Display();  // Derived์˜ Display ํ˜ธ์ถœ
    }
}

 

 

๐Ÿ“Œ ์ƒ์† ์˜ˆ์‹œ

#include <iostream>

using namespace std;

class Employee {

public : 
	Employee() {
		cout << "emp ๋””ํดํŠธ ์ƒ์„ฑ์ž " << endl;
	}

	Employee(const char* name, const char* address) {
		cout << "emp ์ธ์ž ๋‘๊ฐœ ์ƒ์„ฑ์ž " << endl;
		this->name = new char[strlen(name) + 1];
		this->address = new char[strlen(address) + 1];

		strcpy_s(this->name, strlen(name) + 1, name);
		strcpy_s(this->address, strlen(address) + 1, address);
	}

	~Employee() {
		cout << "emp ์†Œ๋ฉธ์ž ํ˜ธ์ถœ" << endl;
		delete[] name;
		delete[] address;
	}


	char* getName() {
		return this->name;
	}

	char* getAddress() {
		return this->address;
	}

	void Print() {
		cout << "์ด๋ฆ„: " << this->getName() << ", ์ฃผ์†Œ: " << this-> getAddress() << endl;
	}

	virtual double PayCheck() const = 0;

protected :
	char* name;
	char* address;
};

class RegularEmployee : public Employee {


public : 

	RegularEmployee() {
		cout << "reg ๋””ํดํŠธ ์ƒ์„ฑ์ž " << endl;
	}

	RegularEmployee(const char* name, const char* address, double salary)
		: Employee(name, address) {
		cout << "reg ์ธ์ž ์„ธ๊ฐœ ์ƒ์„ฑ์ž " << endl;
		
		this->salary = salary;
	}

	~RegularEmployee() {
		cout << "rag ์†Œ๋ฉธ์ž ํ˜ธ์ถœ" << endl;
	}

	double PayCheck() const override {
		return salary * 12;
	}

private :
	double salary;

};

class TemporaryEmployee : public Employee {


public : 

	TemporaryEmployee() {
		cout << "temp ๋””ํดํŠธ ์ƒ์„ฑ์ž " << endl;
	}

	TemporaryEmployee(const char* name, const char* address, double dailyPayCheck, int days)
		: Employee(name, address) {
		cout << "temp ์ธ์ž ์„ธ๊ฐœ ์ƒ์„ฑ์ž " << endl;

		this->dailyPayCheck = dailyPayCheck;
		this->days = days;
	}


	~TemporaryEmployee() {
		cout << "temp ์†Œ๋ฉธ์ž ํ˜ธ์ถœ" << endl;
	}

	double PayCheck() const override {
		return this->dailyPayCheck * days * 12;
	}

private :
	double dailyPayCheck;
	int days;
};

class SalesMan : public RegularEmployee {

public : 

	SalesMan() {
		cout << "sales ๋””ํดํŠธ ์ƒ์„ฑ์ž " << endl;
	}

	SalesMan(const char* name, const char* address, double salary, double allowance) 
		: RegularEmployee(name, address, salary) {
		cout << "sales ์ธ์ž ๋„ค๊ฐœ ์ƒ์„ฑ์ž " << endl;
		this->allowance = allowance;
	}

	~SalesMan() {
		cout << "sales ์†Œ๋ฉธ์ž ํ˜ธ์ถœ" << endl;
	}

	double PayCheck() const override {
		return RegularEmployee::PayCheck() + (allowance * 12);
	}

private:
	double allowance;
};

// Employee ๊ด€๋ฆฌ ํด๋ž˜์Šค
class Department {
public :
	Department() {
		this->count = 0;
	}

	~Department() {
	}

	// ๊ฐ์ฒด๋ฅผ ์ „๋‹ฌ ์ธ์ž๋กœ ๋ฐ›์•„ ๊ฐ์ฒด ๋ฐฐ์—ด์— ๋„ฃ์–ด ๊ด€๋ฆฌ
	void Insert(Employee& emp) {
		this->emp[count] = &emp;
		count++;
	}

	// ํ˜„์žฌ ๊ด€๋ฆฌ ์ค‘์ธ ๊ฐ์ฒด์˜ ๊ธ‰์—ฌ ์ถœ๋ ฅ
	void Print() const {
		for (int i = 0; i < count; i++) {
			cout <<"[" << this->emp[i]->getName() << "] ";
			cout << this->emp[i]->PayCheck() << endl;
		}
	}

private:
	Employee* emp[10];
	int count;
};


void main() {

	//Employee e("ํšŒ์‚ฌ์›", "ํšŒ์‚ฌ์› ์ฃผ์†Œ");
	//e.print();

	RegularEmployee re("์ •๊ทœ์ง์›", "์ •๊ทœ์ง์› ์ฃผ์†Œ", 550);
	//cout << re.PayCheck() << endl;

	TemporaryEmployee te("๊ณ„์•ฝ์ง", "๊ณ„์•ฝ์ง ์ฃผ์†Œ", 10, 20);
	//cout << te.PayCheck() << endl;

	SalesMan sm("jung", "๋ถ„๋‹น", 300, 50);
	//cout << sm.PayCheck() << endl;

	/*Employee* salesMan = (Employee*) new SalesMan("์ •์˜์—…", "๋ถ„๋‹น", 500, 50);
	cout << salesMan->PayCheck() << endl;*/

	Department dpt;
	dpt.Insert(re);
	dpt.Insert(te);
	dpt.Insert(sm);

	dpt.Print();

}

 

 

 

๐Ÿ“Ž์ฐธ๊ณ 

 

[C++] ๋™์  ๋ฐ”์ธ๋”ฉ, ์ •์  ๋ฐ”์ธ๋”ฉ

๋™์  ์ •์  ๋ฐ”์ธ๋”ฉ ์‚ฌ์ „ ์ค€๋น„ * ๋จผ์ € ๋‹คํ˜•์„ฑ์— ๋Œ€ํ•œ ๊ฐœ๋…์„ ์•Œ๊ณ  ์žˆ์–ด์•ผ ํ•œ๋‹ค. https://licktwice.tistory.com/59https://licktwice.tistory.com/59 [JAVA]์ž๋ฐ” - ๋‹คํ˜•์„ฑ Polymorphism ๋‹คํ˜•์„ฑ Polymorphism OOP์˜ 4๋Œ€ ํŠน์„ฑ * ๋‹คํ˜•

licktwice.tistory.com

 

'C, C++' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๋‹ค๋ฅธ ๊ธ€

[C++] STL  (0) 2024.09.05
[C++] ํ…œํ”Œ๋ฆฟ(Template)  (0) 2024.08.29
[C++] ๊ฐ์ฒด ์ง€ํ–ฅ  (6) 2024.08.19
[C] ๋™์  ๋ฉ”๋ชจ๋ฆฌ ํ• ๋‹น  (0) 2024.08.13
[C] ๊ตฌ์กฐ์ฒด, ๊ณต์šฉ์ฒด  (0) 2024.08.13