cpp programs and answers

21. Differentiate the following notations?
I: :obj1 :obj2

II: :obj1 :obj2

In the above representation I, obj1 sends message to obj2. But in the case of II the data is transferred from obj1 to obj2.

22. USECASE is an implementation independent notation. How will the designer give the implementation details of a particular USECASE to the programmer?
This can be accomplished by specifying the relationship called “refinement” which talks about the two different abstraction of the same thing.
Or example,

calculate pay calculate

class1 class2 class3

23. Suppose a class acts an Actor in the problem domain, how to represent it in the static model?
In this scenario you can use “stereotype”. Since stereotype is just a string that gives extra semantic to the particular entity/model element. It is given with in the << >>.

		class A
		<< Actor>>
		attributes
 
		methods.

24. Why does the function arguments are called as “signatures”?
The arguments distinguish functions with the same name (functional polymorphism). The name alone does not necessarily identify a unique function. However, the name and its arguments (signatures) will uniquely identify a function.
In real life we see suppose, in class there are two guys with same name, but they can be easily identified by their signatures. The same concept is applied here.
ex:

		class person
		{
	      public:
			char getsex();
			void setsex(char);
			void setsex(int);
		};

In the above example we see that there is a function setsex() with same name but with different signature.

Leave a Reply

You must be logged in to post a comment.