Skip to content

Latest commit

 

History

History
351 lines (267 loc) · 9.1 KB

File metadata and controls

351 lines (267 loc) · 9.1 KB

📖 Quick Reference Guide

A fast reference to common OOP concepts, commands, and resources in this repository.


🚀 Quick Start Commands

C++ Compilation

# Basic compilation
g++ filename.cpp -o output

# With C++17 standard and warnings
g++ -std=c++17 -Wall -Wextra filename.cpp -o output

# Multiple files
g++ file1.cpp file2.cpp -o output

# Run the program
./output                # Linux/Mac
output.exe              # Windows

Java Compilation

# Compile
javac ClassName.java

# Run
java ClassName

# Compile with warnings
javac -Xlint:all ClassName.java

📚 Core OOP Concepts

The Four Pillars of OOP

  1. Encapsulation 🔒

  2. Inheritance 🌳

  3. Polymorphism 🎭

  4. Abstraction 🎨


🔑 Key C++ Concepts

Classes and Objects

class MyClass {
private:
    int data;
public:
    MyClass(int d) : data(d) {}  // Constructor
    ~MyClass() {}                 // Destructor
    void display() { cout << data; }
};

MyClass obj(10);  // Object creation

Pointers and References

int* ptr = new int(10);    // Pointer
int& ref = *ptr;           // Reference
delete ptr;                // Memory cleanup

Inheritance

class Base {
    // Base class
};

class Derived : public Base {
    // Derived class
};

Virtual Functions

class Base {
public:
    virtual void display() {
        // Can be overridden
    }
};

☕ Key Java Concepts

Classes and Objects

public class MyClass {
    private int data;
    
    public MyClass(int d) {  // Constructor
        this.data = d;
    }
    
    public void display() {
        System.out.println(data);
    }
}

MyClass obj = new MyClass(10);  // Object creation

Inheritance

public class Base {
    // Base class
}

public class Derived extends Base {
    // Derived class
}

Interfaces

public interface MyInterface {
    void method();  // Abstract method
}

public class MyClass implements MyInterface {
    public void method() {
        // Implementation
    }
}

Exception Handling

try {
    // Code that may throw exception
} catch (Exception e) {
    // Handle exception
} finally {
    // Always executes
}

📂 Repository Navigation

By Topic

Topic C++ Location Java Location
Basics Lecture 01 Chapter 1-2
Classes Lecture 02-03 Chapter 9
Memory Management Lecture 04 N/A (Automatic)
Overloading Lecture 05-06 Chapter 6, 11
Inheritance Lecture 07 Chapter 11
I/O Lecture 08-09 Chapter 12
Polymorphism Lecture 10 Chapter 11
Templates/Generics Lecture 11, 14 N/A (Built-in)
Exceptions Lecture 11 Chapter 12
Abstract Classes Lecture 10 Chapter 13

By Difficulty

  • Beginner: Lectures 01-02, Chapters 1-4
  • Intermediate: Lectures 03-07, Chapters 5-9
  • Advanced: Lectures 08-14, Chapters 10-13

🛠️ Common Issues & Solutions

C++ Issues

Problem: undefined reference to...

# Solution: Link all required files
g++ main.cpp class.cpp -o output

Problem: Memory leaks

// Solution: Always delete allocated memory
int* ptr = new int(10);
delete ptr;  // Don't forget!

Problem: Segmentation fault

// Solution: Check for null pointers
if (ptr != nullptr) {
    // Use pointer
}

Java Issues

Problem: Could not find or load main class

# Solution: Ensure class name matches filename
javac ClassName.java
java ClassName  # Not ClassName.java

Problem: NullPointerException

// Solution: Check for null
if (obj != null) {
    obj.method();
}

📝 Useful Documentation

Repository Guides

External Resources

C++

Java

General OOP


🎓 Study Tips

  1. Start Sequential: Begin with Lecture 1/Chapter 1
  2. Practice Daily: Code along with examples
  3. Understand Don't Memorize: Focus on concepts
  4. Debug Often: Learn from errors
  5. Use Documentation: Check guides when stuck
  6. Ask Questions: Use issue templates
  7. Review Regularly: Revisit earlier topics

🔍 Search Tips

GitHub Search

  • Find specific topics: keyword in:path
  • Search code: function_name language:cpp
  • Find files: filename:*.cpp

In This Repo

  • Use Content Index for organized navigation
  • Check folder README files for detailed info
  • Use Ctrl+F to search within files

📊 Repository Statistics

  • C++ Programs: 139+
  • Java Programs: 17+
  • Documentation Files: 80+
  • Lectures/Chapters: 27
  • Topics Covered: 50+

⚡ Quick Links

Need Link
Setup Help Getting Started
Find Topic Content Index
Report Bug Bug Report
Ask Question Question Template
Suggest Feature Feature Request
Get Support Support Guide
Contribute Contributing Guide

🎯 Common Tasks

Setting Up Development Environment

  1. Install compiler/JDK (guide)
  2. Clone repository
  3. Navigate to desired topic
  4. Compile and run examples

Studying a New Topic

  1. Read topic's README.md
  2. Review code examples
  3. Understand concepts
  4. Try practice problems
  5. Test your understanding

Getting Help

  1. Check relevant documentation
  2. Search existing issues
  3. Ask in discussions
  4. Create an issue if needed

📱 Keep Learning

Remember:

  • ✅ Make mistakes - they're learning opportunities
  • ✅ Practice regularly - consistency is key
  • ✅ Ask questions - no question is too small
  • ✅ Help others - teaching reinforces learning
  • ✅ Have fun - enjoy the journey!

Happy Coding! 🚀

For detailed information, always refer to the complete documentation in the repository.