#include<iostream> using namespace std; class base { double x; public: void setx(double i) { x=i; } void showx() { cout<<"X = "<<x<<endl; } }; class derived :public base { double y; public: void sety(double i) { y=i; } void showy() { cout<<"Y = "<<y<<endl; } }; int main() { derived obj; obj.setx(10); obj.sety(20); obj.showx(); obj.showy(); return 0; }