ÃßõµÇ¾ú½À´Ï´Ù.
|
´ÜÃà URL: https://humoruniv.com/program5937 URL º¹»ç |
error ºÎºÐ¿¡ "+" ¿¬»êÀÚ Áß µÎ °³ ÀÌ»óÀÌ ÀÌ ÇÇ¿¬»êÀÚ¿Í ÀÏÄ¡ÇÕ´Ï´Ù ¶ó°í ¶ß´Âµ¥
¿Ã¹Ù¸£°Ô ¹Ù²Ü¼öÀÕ³ª operator°¡ µÎ°³°¡ Á¤ÀǵǼ ÄÄÇ»ÅͰ¡ ¸ø¾Ë¾Æº½;;
#include <iostream>
using namespace std;
class A {
private:
int lux;
float lex;
public :
A() :lux(0), lex(0) {}
A(B a) {
lux = a.pi * 50;
lex = a.pe * 50;
}
A(int a, float b);
friend class B;
friend ostream& operator<<(ostream& os, const A& p);
friend A operator+(const A&, const A&);
};
class B {
private:
int pi;
float pe;
public:
B():pi(0),pe(0){}
B(A a) {
pi = a.lux *3;
pe = a.lex *3;
}
B(int a, float b);
B(const B&);
friend class A;
friend ostream& operator<<(ostream& os, const B& p);
friend B operator+(const B&, const B&);
};
int main() {
B test;
A tost;
test = A(1,0.2) + B(1, 0.2); // *Error
tost = B(1, 0.3) + A(1, 0.2);
cout << test;
cout << A(1, 0.2);
<ÀÌÇÏ»ý·«>
|
¡ã ´ÙÀ½±Û | 2011³â ÄÄÇ»ÅͰøÇаú Çö½ÇÀ̶ó´Â ±Û | ¾È»ç¶û |
![]() ![]() ![]() ![]() |
2018-04-27 [13:17] |
¡å ÀÌÀü±Û | ÀÌ°Ô ÁøÂ¥ °¡´ÉÇѰ¡... | À©ÅÍȦµå´ëÇб³È¯Çлý |
![]() ![]() ![]() ![]() |
2018-04-25 [22:49] |
![]() |
°í¿î¸»»ç¿ëÀÚ |
A+B, B+AÀε¥ A+A, B+B·Î Á¤ÀÇÇß´ø°¡..?? ¿À¹ö·Îµù ³Ñ ¾î·Æ´Ù..¤Ì
|
00 |
![]() ![]() ![]() ![]() |
2018-04-27 |
¡ã ´ÙÀ½±Û | 2011³â ÄÄÇ»ÅͰøÇаú Çö½ÇÀ̶ó´Â ±Û | ¾È»ç¶û |
![]() ![]() ![]() ![]() |
2018-04-27 [13:17] |
¡å ÀÌÀü±Û | ÀÌ°Ô ÁøÂ¥ °¡´ÉÇѰ¡... | À©ÅÍȦµå´ëÇб³È¯Çлý |
![]() ![]() ![]() ![]() |
2018-04-25 [22:49] |