1
Answer

change C++ code into C#

Bing In

Bing In

8y
388
1
change the code below into C sharp code 
result must be the same 
 
 

 
 
class CA {
public: CA(int a) { a_data = a; }
protected: int a_data;
};
 
class CB : public CA {
public: CB(int b);
            void display();
private: int b_data;
};
 
CB::CB(int b) : CA(b) { b_data = b; }
void CB::display() {
      cout << "a_data = " << a_data << "\n";
      cout << "b_data = " << b_data << "\n";
}
 
void main() {
CB a(1);
a.display();
CB b(3);
b.display(1);
Answers (1)