Ad Code

Syntax for inheritance

1.    If we write one class inside the other class, then can we say the inside class is a child class of the outer class and will inherit all the properties of the parent class? or is there a special syntax for inheritance?

2.    If i write a class which does not has any attributes but only has behavior(functions) is it possible; it is analogues to a person which is an object, which only has a name and only perform some function, rest nothing; possible?

3.    What is the difference between Public, Private and Protected interface of a class?

4.    If i write my class, then how i explain its interface to the other programmer, who have to use my class, in his own code?

5.    What is "typedef" syntax used in C++? what is its function and application?


1. There are specific way known as access specifiers which helps in controlling the inheritance of attributes and methods to the child classes. In detail you will learn in upcoming classes so hold your horses for a little while.
2. Mapping of an object to a class is clearly depends on your understandings and requirements.
3. Public is for all, private is for self and protected will go to child classes.
4. One way is the use of documentation which you will provide with your class.
5. typedef is a keyword in the C and C++ programming languages. The purpose of typedef is to assign alternative names to existing types, most often those whose standard declaration is cumbersome, potentially confusing, or likely to vary from one implementation to another.
Reactions

Post a Comment

0 Comments