Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
cppPyPoly2
//g++ 7.4.0 //cppPyPoly2: another C++ equivalent of PyPoly program (created on April 05,2022) //this code is created by Rezaul Hoque on April 06,2022; //contact:jewelmrh@yahoo.com;Dhaka,Bangladesh;https:/rezaulhoque.wordpress.com,https://hoquestake.blogspot.com //note: codes shared by Rezaul Hoque on rextester are not for sale; they are created and shared to facilitate the algorithm learning process; many like Hoque use this platform to practice programming ;Rezaul hopes his contribution helps others to fine tune their learning; #include <iostream> #include <string> class Polyex{ protected: std::string name; std::string address; std::string occupation; public: void setAtb(std::string a, std::string b,std::string c){ name=a;address=b; occupation=c;} std::string getNam(){ return name;} std::string getAd(){return address;} std::string getOccu(){return occupation;} void display (){ std::cout<<"name:"<<this->getNam(); std::cout<<"\n"; std::cout<<"address:"<<this->getAd(); std::cout<<"\n"; std::cout<<"occupation:"<<this->getOccu(); std::cout<<"\n"; } }; class Polyex1:public Polyex{ }; class Polyex2:public Polyex{ }; int main() { Polyex1 poly1; Polyex2 poly2; Polyex* p1=&poly1; p1->setAtb("ABC","road:00,city:noville,country: nulpart","xzc"); Polyex * p2= &poly2; p2->setAtb("XYZ","road: 0,city:Utoville,country: zeroland","fgh"); p1->display(); std::cout<<"\n"; p2->display(); return 0; }
run
|
edit
|
history
|
help
0
typedef
runtime template mode processor
OOP
mur1
Test 5(2020)
pointer array of functions
MyStringv2
Exempel 2
Bez królików
Good1