c++ Derivation

Posted by:
Ping Yu 3 months ago
class Base {
public:
  int a,b;
};

class Derived : public Base {
public:
  int c;
};

int main() {
  Derived d;
  d.a = 1;    // Base::a
  d.b = 2;    // Base::b
  d.c = 3;    // Derived::c
}

Comments

No one has commented on this yet.

You must be logged in to post a comment.