Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ Create a class named LineSeg and write the code for the .h and .cpp files (credit pts shown alongside) 1. Provide 2 private data

C++

Create a class named LineSeg and write the code for the .h and .cpp files (credit pts shown alongside)

1. Provide 2 private data members of type Point named m_pta and m_ptb for the class LineSeg. (2)

2. Provide a single constructor for the class LineSeg that takes 2 Point objects by const reference which are then used to initialize m_pta and m_ptb private data members mentioned above. (2)

3. Provide a destructor for the class LineSeg. (1)

4. Provide accessor (i.e. get.) and mutator (i.e. set) functions (4)

5. Show how you would prevent clients of the LineSeg class from using its copy constructor. (1)

6. Show how you would prevent clients of the LineSeg class from using its default constructor. (1)

7. Create a main function in which you

Create 4 points p1, p2, p3, p4 with any arbitrary x, y co-ordinates of your choice. (1)

Create a LineSeg object named lss using the 2 point objects p1 and p2 you created above by invoking the LineSeg class constructor in the local stack space. (1)

Create a LineSeg object pointer name plsh which you then use to heap allocate a single LineSeg object in the using the 2 point objects p3, p4 and an appropriate C++ operator. (2)

Show how to call the get methods on the lss and plsh objects to print out the x, y co-ordinates of endpoints of the 2 LineSeg objects. (3)

Show how you will return heap allocated memory back to the runtime before exiting function main. (2)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases DeMYSTiFieD

Authors: Andy Oppel

2nd Edition

0071747990, 978-0071747998

More Books

Students also viewed these Databases questions

Question

1. Identify what positions are included in the plan.

Answered: 1 week ago

Question

2. Identify the employees who are included in the plan.

Answered: 1 week ago

Question

7. Discuss the implications of a skill-based pay plan for training.

Answered: 1 week ago