fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. class cb{
  5. private:
  6. int v1;
  7. int v2;
  8.  
  9. public:
  10.  
  11.  
  12. cb(int n1,int n2){
  13.  
  14. v1=n1;
  15. v2=n2;
  16.  
  17.  
  18. }
  19.  
  20. void fs(){
  21.  
  22. cout<<v1<<" ";
  23. cout<<v2<<"\n";
  24.  
  25.  
  26.  
  27. }
  28.  
  29.  
  30.  
  31.  
  32. };
  33.  
  34.  
  35. class cd : cb{
  36.  
  37. private:
  38. int v3;
  39.  
  40. public:
  41. cd(int n3){
  42.  
  43. v3=n3;
  44.  
  45. }
  46.  
  47. void fscd(){
  48.  
  49. cout<<v3<<"\n";
  50.  
  51. }
  52.  
  53.  
  54.  
  55. };
  56.  
  57.  
  58.  
  59.  
  60. int main() {
  61.  
  62.  
  63. cb oggcb(100,200);
  64.  
  65. oggcb.fs();
  66.  
  67.  
  68. cd oggcd(300);
  69.  
  70. oggcd.fscd();
  71.  
  72. oggcb.fs();
  73.  
  74.  
  75. return 0;
  76. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In constructor ‘cd::cd(int)’:
prog.cpp:41:12: error: no matching function for call to ‘cb::cb()’
  cd(int n3){
            ^
prog.cpp:12:2: note: candidate: ‘cb::cb(int, int)’
  cb(int n1,int n2){
  ^~
prog.cpp:12:2: note:   candidate expects 2 arguments, 0 provided
prog.cpp:4:7: note: candidate: ‘constexpr cb::cb(const cb&)’
 class cb{
       ^~
prog.cpp:4:7: note:   candidate expects 1 argument, 0 provided
prog.cpp:4:7: note: candidate: ‘constexpr cb::cb(cb&&)’
prog.cpp:4:7: note:   candidate expects 1 argument, 0 provided
stdout
Standard output is empty