Constructor with Parameters

#include <iostream>
using namespace std;

class UART {
    int baudRate;
    char parity;
public:
    // your code here: define constructor with parameters baudRate and parity
    UART(int b, char p){
       baudRate=b;
       parity=p;
       cout << "UART initialized with baud=" << b << ","<< " parity=" << p << endl;
    }
};

int main() {
    UART u(9600, 'N');
    return 0;
}
Upvote
Downvote
Loading...

Input

Expected Output

UART initialized with baud=9600, parity=N