Skip to main content
1 of 6
tp1
  • 1.9k
  • 12
  • 11

Programming with abstract data types means that when you write:

struct A { int i; float k; };

You can use A a; as abstraction of some bits like [00000000][00000000]. (with proper number of bits)

Inheritance adds the following feature:

class A { public: virtual void f()=0; };
class B1 : public A { public: void f() { ... } int a; int b; };
void g(A &a) { a.f(); a.f(); }
int main() { B1 b; g(b); }

I.e. when there are several classes like B1,B2,B3 the algorithms like g() can work with all of them.

tp1
  • 1.9k
  • 12
  • 11