Run Code
|
API
|
Code Wall
|
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
Error
Test bitfields with unnamed union
test
hello world 3
LOOL
khcmknhc
auto Keyword Example
6 7
Palindrome Recursive Function Example
vector flavors....