• Courses
  • Code Compiler
  • Discuss
  • Pricing
  • Teams
Menu
0

When should you declare a class?

Do you declare a class before int main() or inside int main()?

classescppquestionhelphelp-meplease-helpdeclare-a-class
4th May 2018, 10:35 AM
Jackson Meddows
Jackson Meddows - avatar
1 Answer
+ 10
Before or after, not inside If you declare it after you must forward declare it. See forward declaration: http://www.learncpp.com/cpp-tutorial/17-forward-declarations/
4th May 2018, 10:43 AM
jay
jay - avatar

Often have questions like this?

Learn more efficiently, for free:

  • Introduction to Python

    7.1M learners

  • Introduction to Java

    4.7M learners

  • Introduction to C

    1.5M learners

  • Introduction to HTML

    7.5M learners

See all courses
Hot today
Hi help me I am new
2 Votes
My codebits section is full of deleted codes
12 Votes
Why are there like 10 community-made lessons?
0 Votes
How do I solve all test cases for popsicles problem?https://www.sololearn.com/coach/3?ref=app
0 Votes
Why so many mathematical questions in challenges?
0 Votes
Where did mess up....
1 Votes
Where can I learn c#
0 Votes
I have an error in a problem and I don't know what the correct answer is
1 Votes
best language if i want to learn about AI
0 Votes
DBA for finalist university student projects
0 Votes