[ create a new paste ] login | about

Link: http://codepad.org/gxrFs0NE    [ raw code | output | fork ]

C++, pasted on Nov 5:
        #include <iostream>
	using namespace std;

	class Basic {
		protected:
		double height;
		double weight;

		public:
		Basic(){}
		virtual void Show() const = 0;
	};

	class Human : public Basic {
		public:
		Human();
		virtual void Show() const;
	};

	Human::Human() : Basic(), height(180.0), weight(80.0) {
	}

	void Human::Show() const {
		cout << "身長: " << height << endl;
		cout << "体重: " << weight << endl;
	}


Output:
1
2
3
t.cpp: In constructor 'Human::Human()':
Line 20: error: class 'Human' does not have any field named 'height'
compilation terminated due to -Wfatal-errors.


Create a new paste based on this one


Comments: