Thursday, July 9, 2009

How to implement inheritance without using language feature?

how to implement inheritance without using language feature for example in C++ to implement you use inheritance feature like Class A{ //..... declaration} and now you derive Class B:public A{ ......}.


I want to know a mechanism in C++ or C# or java any langauge which support OOAD for implementing inheritance.

How to implement inheritance without using language feature?
maybe http://search.msdn.microsoft.com/search/... will help u...
Reply:I'm not sure about C++, but in java the reserved word "extends" is used for inheritance





public class A {


// vars


// functions


}





public class B extends A {


// vars


// functions


}





B will inherit A's variables and functions unless it overrides them in its own class.





cheers

survey software

No comments:

Post a Comment