Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

arguments to a class instance c++

int courseId = 0;
Instructor instructor; // Here we default construct an Instructor
std::string courseName = "Foo";
std::string dept = "Bar";

Course my_course(courseId, instructor, courseName, dept);
//                         ^^^^^^^^^^
//              Here the Instructor is being passed
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #arguments #class #instance
ADD COMMENT
Topic
Name
8+5 =