Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

So I have a base class List and a Derived class: CBL (circular buffer list). the List.h is pure virtual and forces CBL.h to define

So I have a base class List and a Derived class: CBL (circular buffer list). the List.h is pure virtual and forces CBL.h

to define its own funtions which I did. However in the test_SSLL.cpp, line 18:

" cop3530::List * list = new cop3530::CBL(); "

I dont know why it is giving the error that is in the output console:

"test_SSLL.cpp:18:56: error: invalid new-expression of abstract class type 'cop3530::CBL'"

To my knowledge its trying to take a List pointer and pass it in to to the CBL to make a CBL filled with List pointers. Can you please provide me with what the error means and If im understanding what the line in test_SSLL.cpp(mentioned above) is doing? Do i need to make a modified constructor or something? I'm not looking for code but i'd appreciate an explanation.

test_SLL.cpp - test functions for the "List" class and derived class "CBL"

image text in transcribed

List.h - this is the bae class and doesnt do much else other than say that we need to define the functions in the derived class

image text in transcribed

CBL.h this is the circular buffer list and I correctly inherited the base class and defined all functions, added a constructor and a destructor

image text in transcribed

#include "catch.hpp" #include 7 bool equals (const char& a, const char& b) { return a : 11| SCENARIO ("INTERFACE TEST") GIVEN ("List of characters") { //cop3530: :Listchar> * 113t = new cop3 5 30: :SSLL(); // cop3530: :Listchar> * 113t = new cop3530 :: PSLL(); // cop3530: :Listchar> * list = new cop3 5 30 :: SDAL(); //cop3530: :Listchar> * list = new cop3530: :CDALCchar>(); 15 16 * Cop3 5 3 0: :List list=-new cop3530: :CBL(); list->insert ('A', 0) list->insert (' 1) list->push_back('C) list- push_front ('D) list-xprint (std::cout) WHEN ("Peek front is called") ( char front list->peek_front ) THEN ("Item should be D") REOUIRE (front D) 30 31 WHEN ("Peek back is called") char back = list->peek back ( ); Output -kart (Build, Run) x mkdir -p build/Debug/Cygwin-Windows rm -f "build/Debug/Cygwin-Windows/test SSLL.o.d" g++ -c-g -MMD -MP-MF "build/Debug/Cygwin-Windows/test SSLL.o.d" -o build/Debug/Cygwin-Windows/tes test SSLL.cpp: In function 'void CAT C H T E ST00: test SSLL.cpp: 18:56: error: invalid new-expression of abstract class cop3530::List *list -new cop3530::CBL) In file included from test SSLL.cpp: 3:0: CBL.h:17:7: note: because the following virtual functions are pure within "cop3530::CBLKchar>: class CBL public List In file included from CBL.h:7:0 #include "catch.hpp" #include 7 bool equals (const char& a, const char& b) { return a : 11| SCENARIO ("INTERFACE TEST") GIVEN ("List of characters") { //cop3530: :Listchar> * 113t = new cop3 5 30: :SSLL(); // cop3530: :Listchar> * 113t = new cop3530 :: PSLL(); // cop3530: :Listchar> * list = new cop3 5 30 :: SDAL(); //cop3530: :Listchar> * list = new cop3530: :CDALCchar>(); 15 16 * Cop3 5 3 0: :List list=-new cop3530: :CBL(); list->insert ('A', 0) list->insert (' 1) list->push_back('C) list- push_front ('D) list-xprint (std::cout) WHEN ("Peek front is called") ( char front list->peek_front ) THEN ("Item should be D") REOUIRE (front D) 30 31 WHEN ("Peek back is called") char back = list->peek back ( ); Output -kart (Build, Run) x mkdir -p build/Debug/Cygwin-Windows rm -f "build/Debug/Cygwin-Windows/test SSLL.o.d" g++ -c-g -MMD -MP-MF "build/Debug/Cygwin-Windows/test SSLL.o.d" -o build/Debug/Cygwin-Windows/tes test SSLL.cpp: In function 'void CAT C H T E ST00: test SSLL.cpp: 18:56: error: invalid new-expression of abstract class cop3530::List *list -new cop3530::CBL) In file included from test SSLL.cpp: 3:0: CBL.h:17:7: note: because the following virtual functions are pure within "cop3530::CBLKchar>: class CBL public List In file included from CBL.h:7:0

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

Students also viewed these Databases questions

Question

Select suitable tools to analyze service problems.

Answered: 1 week ago