All submissions

Constructor with Parameters

#include <iostream>
#include <string>
using namespace std;

class UART {
public:
    // your code here: define constructor with parameters baudRate and parit
    char parity;
    int baudRate;
    UART(int baud, char par) : baudRate(baud), parity(par){
        std::cout << "UART initialized with baud="<<this->baudRate << ", parity="<< parity;
    }
};

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

Input

Expected Output

UART initialized with baud=9600, parity=N