Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Member inheritance
//clang 3.8.0 #include <iostream> class p{ protected: int w,h; public: void setv(int b,int a){w=b;h=a;} }; class Rect:public p{ public: int area(){return w*h;} }; class Tri:public p{ public: int area(){return w*h/2;} }; int main() { Rect r; Tri t; r.setv(2,5); t.setv(3,4); std::cout << r.area()<<std::endl; std::cout<<t.area(); }
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
Set sub sequences.
AnnotateAttr templated test
K combinator - Lazy evaluation
Merge Sort
Dynamic call
cv5_class
hello world
Throttle Example (Send two requests every two seconds)
Template Meta Programming
7
Please log in to post a comment.