Загрузка данных


// ConsoleApplication10.cpp : Этот файл содержит функцию "main". Здесь начинается и заканчивается выполнение программы.
//

#include <iostream>
#include <string>
using namespace std;
class Fruit {  public:
	int price;
	virtual string Name() { return "fruit"; }
};
class Apple : public Fruit{   public:
	int sugar;
	string Name() { return "aplle"; }
};
int main(){ 	Fruit* pf;
	Fruit f1;
	pf = &f1;
	cout << pf->Name() << endl;//fruit
	Apple a1;
	pf = &a1;	//apple in the busket of fruit
	cout << pf->Name() << endl;//apple

	//Fruit f1;
	//Apple a1;
	//f1 = a1;
	//cout << f1.Name() << endl;//
}