In C++ we can declare a class in a .h file and can have the definitions for functions across multiple files. Is this concept same by using partial keyword with classes in C#?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
No it’s not. The partial keyword in C# allows you to add new methods and members to a class. In c++, once a class is defined in a header, you need to change that header in order to change the class, you can’t just declare new methods/members in a different header.
C#:
Now class A has both functions f and g.
In C++ however, once you define:
f will become the only method in A. You can’t declare new methods in a new header file nor define methods that are not in the class definition in cpp files.