The following code shows how we derive a class from other class.
class Base
{
...
}
class Derived: public Base
{
....
}
The Derived class is derived from Base with public level of inheritance. If you omit the public word while declaration such as
class Derived : Base
the level of inheritance will be private.
The private inheritance is only supported in unmanaged C++. Its not supported in managed C++. if you declare the compiler will give error.
No comments:
Post a Comment