1 Briefly describe which elements of a class use the Pascal

1. Briefly describe which elements of a class use the Pascal case, and what are the best practices regarding the naming of these elements.

2.Sometimes the terms Encapsulation and Data/Information Hiding in object-oriented programming are used interchangeably. Is it correct to use the terms interchangeably? Why or why not?

Question 3.3. (TCO 2) Given the following list of classes, attributes and methods,

·         identify which items are classes, which items are attributes and which items are methods;
·         identify which class each attribute and method belongs to; and
·         suggest a class hierarchy given your list of classes.

*Note - no particular capitalization scheme is used in the list below to differentiate between classes, methods, and attributes.

LandOnStatue, NumberOfLegs, Height, ShoeSize, Eat, Animal, Speak, WingSpan, Age, Peck, Sleep, Horse, LengthOfMane, Move, BeakLength, LengthOfTail, Bird, SaddleUp

4.How do you distinguish between virtual functions and pure virtual functions? How do you use the abstract class and the methods defined inside the abstract class?

Question 5.5. Explain how inheritance allows you to use knowledge of general situations and apply it to more specific categories. List the benefits of using inheritance.

6. How does polymorphism promote extensibility? How does polymorphism enables you to program \"in the general\" rather than \"in the specific.\" Explain the key advantages of programming \"in the general.\"

7. Define and implement the overloaded constructors that support the following test function for a Rectangle class. The data members for the Rectangle class are:

• length - integer number
• width - integer number

int main()
{ Rectangle r1(); //r1 will take all default value
Rectangle r2(4, 5); //r2 will take all supplied value
Rectangle r3(10); //r3 will take supplied length, width will take default value
Rectangle r4= r2; //r4 will take the same value of r2

//the rest of the code
}

Question 3.3. (TCO 2) Given the following list of classes, attributes and methods,

·         identify which items are classes, which items are attributes and which items are methods;
·         identify which class each attribute and method belongs to; and
·         suggest a class hierarchy given your list of classes.

*Note - no particular capitalization scheme is used in the list below to differentiate between classes, methods, and attributes.

LandOnStatue, NumberOfLegs, Height, ShoeSize, Eat, Animal, Speak, WingSpan, Age, Peck, Sleep, Horse, LengthOfMane, Move, BeakLength, LengthOfTail, Bird, SaddleUp

4.How do you distinguish between virtual functions and pure virtual functions? How do you use the abstract class and the methods defined inside the abstract class?

Question 5.5. Explain how inheritance allows you to use knowledge of general situations and apply it to more specific categories. List the benefits of using inheritance.

6. How does polymorphism promote extensibility? How does polymorphism enables you to program \"in the general\" rather than \"in the specific.\" Explain the key advantages of programming \"in the general.\"

7. Define and implement the overloaded constructors that support the following test function for a Rectangle class. The data members for the Rectangle class are:

• length - integer number
• width - integer number

int main()
{ Rectangle r1(); //r1 will take all default value
Rectangle r2(4, 5); //r2 will take all supplied value
Rectangle r3(10); //r3 will take supplied length, width will take default value
Rectangle r4= r2; //r4 will take the same value of r2

//the rest of the code
}

Solution

1) Pascal casing is basically starting first letter Capital and each susequentword is capital. We should use Pascal caisng for all public member, type, and namespace names consisting of multiple words

eg if we want to write a name with multiple words calculatesumofintegers so we should write it like CalculateSumOfIntegers.

2) Yes Encapsulation and data hiding are mostly used intechangeably because these are almost same and there is just thin line of difference between these and could be like Data hiding can be achieved withoutEncapsulation like private constant and we are not returning that constant by getter method. And if we consider applying access modifier we could say it as data hiding as well as encapsulation but here we achieve encapsulation when data is exposed and modified only by setter and getter.

1. Briefly describe which elements of a class use the Pascal case, and what are the best practices regarding the naming of these elements. 2.Sometimes the terms
1. Briefly describe which elements of a class use the Pascal case, and what are the best practices regarding the naming of these elements. 2.Sometimes the terms

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site