How do you define a class in c++?



How do you define a class in c++?..

Answer / Deepak Mavi

In C++, you define a class using the 'class' keyword followed by the class name and curly braces containing its member variables and functions. Example: n```nclass MyClass {npublic:n int myVar;n};n```

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C++ General Interview Questions

What is the difference between public, private, protected inheritance?

12 Answers   Wipro,


How long it will take to learn c++?

1 Answers  


What is the Difference between "C structure" and "C++ structure"?

12 Answers  


What is the equivalent of Pascal's Real a) unsigned int b) float c) char

1 Answers  


Which software is used to run c++ program?

1 Answers  


What is a mutable member?

1 Answers  


Why is c++ is better than c?

1 Answers  


What is scope of a variable? (LOLZ)

2 Answers   CA, TCS,


Name the implicit member functions of a class.

1 Answers  


What is the difference between a shallow copy and a deep copy?

3 Answers  


What are special characters c++?

1 Answers  


How a macro differs from a template?

1 Answers  


Categories