Category : arguments

I am trying to implement a buffer array but I keep getting errors I don’t know how to fix yet I am very new to this and I really don’t know how to debug and I would really appreciate it this is the error I’m getting below This is my error: BufferArraymain.cpp:9:23: error: no matching ..

Read more

I am trying to implement a buffer array but I keep getting errors I don’t know how to fix yet I am very new to this and I really don’t know how to debug and I would really appreciate it this is the error I’m getting below This is my error: BufferArraymain.cpp:9:23: error: no matching ..

Read more

is there a way to accept as an argument to a function a template with multiple types? For example: void myFunc (myTemplate<[uint16_t | uint32_t]> obj) { // do some stuff here obj.print(); } int main() { myTemplate<uint32_t> arg1 = object.uint32_t_member; myFunc(arg1); myTemplate<uint16_t> arg2 = object.uint16_t_member; myFunc(arg2); } In this example, myFunc would accept either myTemplate<uint16_t> ..

Read more

I am trying to pass array of object in friend function. dut it shows undefined structure ‘Directory’. And also can we use private data members in friend function. Because if I create Private: char name[30]; It shows error ‘Directory::name’ not accessible. #include<conio.h> #include<iostream.h> #include<string.h> #include<stdlib.h> class Directory { private: char phone_no[11]; // char name[30]; public: ..

Read more

#include<iostream> using namespace std; class Inner{ int x; public: Inner(int c) : x(c){ cout << c << " "; } ~Inner(){ cout << x << " "; } }; class Outer{ int x,y; //LINE-1: declare data-members public: Outer(int a, int b) : x(new Inner(a)), y(new Inner(b)){} ~Outer() { cout<<x;cout<<y; } //LINE-2: free the data-members }; ..

Read more

Consider following scenario: I need to process fruits which most of the time I get in combinations [but not always, lets assume] so I created enum as shown below : enum class ProcessInputFruits {None, Apples, Mangoes, PineApples, Grapes, GrapesAndMangoes, ApplesAndPineApples, All}; In my function ProcessFruits I am passing this enum as argument but at the ..

Read more