Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
cppPyClamInher
//g++ 7.4.0 //cppPyClamInher:C++ equivalent of PyClamInher program //this code is created by Rezaul Hoque on February 08,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> //PyClamInher (created on December 16,2021) program looks like: /***** class Name: name = "AWE" @classmethod def detail(cls): print(cls.name) class Id: number = 003 member = "General" class BookClub(Name,Id): dueStat= "All clear" b= BookClub() b.detail() b.name="EWA" b.detail() Name.name="EWA" b.detail() print(b.number) print(b.member) print(b.dueStat) *****/ //Above python program in C++ is like: class Name { protected: std::string name; public: Name(){} Name(std::string s){ name=s;} Name(Name& c){ name=c.name;} ~Name(){} virtual std::string getN() const { return name;} void set(std::string s){ name=s;} void detail() { std::cout<<this->getN();} }; class Id{ protected: int number; std::string member; public: Id(){} Id(int n,std::string b){ number = n; member = b;} Id(Id& c ){ number = c.number; member = c.member;} ~Id(){} virtual int getId() const { return number;} virtual std::string getMem() const { return member;} }; class BookClub: public Name,public Id{ protected: std::string dueStat; public: BookClub(){} BookClub(std::string s,int n,std::string a,std::string d): Name(s),Id(n,a),dueStat(d){} virtual std::string getDue() const { return dueStat;} }; int main() { BookClub b("AWE",003,"General ","All Clear"); b.detail(); std::cout<<"\n"; b.set("EWA"); b.detail(); std::cout<<"\n"; //BookClub::set("EWA"); b.detail(); std::cout<<"\n"; std::cout<<b.getId(); std::cout<<"\n"; std::cout<<b.getMem(); std::cout<<"\n"; std::cout<<b.getDue(); return 0; }
run
|
edit
|
history
|
help
0
Dar
st_match
error
a
sd
maximum nights you can accommodate
VecHotel2
Procesos estocasticos Beta 2.0
ADVENTURE CODE CSCI40
CutRod(BottomUp)