Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
cppPyTeleAbs
//g++ 7.4.0 //cppPyTeleAbs //this code is created by Rezaul Hoque on August 25,2022; update: 9:56 //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 <vector> #include <string> class Person{ std::string first,last; int num; public: Person(){} Person(std::string s,std::string w,int n){first=s;last=w;num=n;} std::string getF(){return first;} std::string getL(){return last;} int getN(){return num;} void print(){std::cout<<getF()<<" "<<getL()<<"\n";} virtual std::string getC()=0; }; class Professional : public Person{ std::string cat; public: Professional (){} Professional (std::string a,std::string b,int n,std::string c):Person(a,b,n),cat(c){} std::string getC(){return cat;} }; class Personal : public Person{ std::string cat; public: Personal (){} Personal (std::string a,std::string b,int n,std::string c):Person(a,b,n),cat(c){} std::string getC(){return cat;} }; int main() { Professional a(" hh","cc",4321,"former "); Professional b("tt","nn",000,"current "); Personal c("yy","mm", 311,"personal"); std::cout<<"Name(first,last) number category \n"; std::cout<<a.getF()<<" "<<a.getL()<<" "<<a.getN()<<" "<<a.getC()<<" \n"; std::cout<<b.getF()<<" "<<b.getL()<<" "<<b.getN()<<" "<<b.getC()<<" \n"; std::cout<<c.getF()<<" "<<c.getL()<<" "<<c.getN()<<" "<<c.getC()<<" \n"; return 0; }
run
|
edit
|
history
|
help
0
basic caculate ii
Zadanie Kalkulator z bajerami
friend function
on_off
Quiz 12/13
lock
Generating π from 1,000 random numbers
Varadic macro
Find value in sorted matrix
codechef