출력 네번째 줄에서 price:3000 , discountprice:2550 을 생각했는데
왜 둘 다 2550이 나오는지 잘 모르겠다......
Product::print() 면 Product 클래스의 print() 안에 this->getPrice()를 출력해야 되는게 아잉교??????
출력 네번째 줄에서 price:3000 , discountprice:2550 을 생각했는데
왜 둘 다 2550이 나오는지 잘 모르겠다......
Product::print() 면 Product 클래스의 print() 안에 this->getPrice()를 출력해야 되는게 아잉교??????
Product:: 가 애초에 임시객체라서 그런거아닌가요? p2객체의 Price 값은 3000인데 discountProduct 내부에서 선언된 product는 discountProduct의 price값과 다른거죠 오버라이딩된 자식의 print()함수내보에서 product::print()라고하지말고 cout<< "price" << getpricemember() << endl; 라고하심 원래 본가격이나올듯?