Tips to Consider with Inheritance in Object Oriented Programming

  Рет қаралды 231

Velcode

Velcode

3 жыл бұрын

This video is an excerpt from my lecture: • Understanding Inherita...
You may have done some object-oriented programming and arrived to the concept of inheritance. In this clip, I discuss a few ideas to have in mind when designing a solution that takes advantage of inheritance in object-oriented programming.

Пікірлер: 8
@shreyasdongre2537
@shreyasdongre2537 2 жыл бұрын
Hey so i have been a viewer of yours, i wanted to ask do u have any idea on how to display linked lists in qt widget application? like which widget to use pls help.. p.s: my comments are getting deleted for some reason. :(
@VelcodeCS
@VelcodeCS 2 жыл бұрын
I think you are being flagged as spam. I saw your comment, and then it wasn't there any more. Try again, but don't put any links. A linked list is a list of items. You can display a list of items in various ways. A set of buttons. A combo box. It really depends on what behavior you want to achieve with that list.
@shreyasdongre2537
@shreyasdongre2537 2 жыл бұрын
@@VelcodeCS oh ah yeah probably i am being flagged as spam. but yes i want to just display the linked list. probably in listWidget? i just want to like print all the nodes of linked list. can u like give a fair idea or just a dummy skeleton code on how to approach this? Edit: ik you mean to say that i can use other stuff but my task itself is to use link list. so i cant use anything else. i have to display the link list. you can see my basic code at cppdotsh/3kxye put. instead of dot.
@VelcodeCS
@VelcodeCS 2 жыл бұрын
@@shreyasdongre2537 Well, what is your linked list made out of? Integers? Strings? Custom-made objects? You have a list of items which you want to display, so the end result is going to be some simple string. You can use a QListWidget, as you suggested, or a QTableWidget (with one column). Either way, you will have to traverse your list and append the item (whatever the node of data represents) to the widget for display. If you look at the QListWidget documentation, it has an insertItem function which you can use per node in your list. Does that make sense?
@shreyasdongre2537
@shreyasdongre2537 2 жыл бұрын
@@VelcodeCS it has string and integers as member variables.. I tried Qlist widget it appends the dara. before appending I did convert the data into QString. but I can't see the data. For some reason. It shows blank. And btw how should I traverse through my link list? in normal c++ I use while loop with condition pointer not equal to null. In qt that kind of traversal doesn't work for some reason idk why. It crashes..
@VelcodeCS
@VelcodeCS 2 жыл бұрын
A QList has members to know how many elements are in the list. Instead of check for null, iterate through all the elements (use count function). You just simply grab the item you need using the same notation as with arrays, where the loop iteration index is used as the list item position index. Ultimately, the point of using something like a QList instead of your own custom made linked list is to benefit from all the functionality that already exists. You shouldn't need to do any pointer work to access the elements.
Object-Oriented Programming is Embarrassing: 4 Short Examples
28:03
100+ Linux Things you Need to Know
12:23
Fireship
Рет қаралды 146 М.
OMG😳 #tiktok #shorts #potapova_blog
00:58
Potapova_blog
Рет қаралды 4,3 МЛН
Looks realistic #tiktok
00:22
Анастасия Тарасова
Рет қаралды 11 МЛН
DO YOU HAVE FRIENDS LIKE THIS?
00:17
dednahype
Рет қаралды 67 МЛН
C++ Pointers and References FULL Guide
53:13
Velcode
Рет қаралды 1,6 М.
Object-Oriented Programming is Bad
44:35
Brian Will
Рет қаралды 2,3 МЛН
5 Tips For Object-Oriented Programming Done Well - In Python
16:08
Hans Niemann Plays Chess With 200% Accuracy... And LOSES!
19:19
Dr. Mike Chess
Рет қаралды 561
How Inheritance Works in Object Oriented Programming
12:06
Understanding Inheritance with C++ | OOP Lecture
1:09:37
Velcode
Рет қаралды 2,1 М.
Object Oriented Programming - The Four Pillars of OOP
11:23
Keep On Coding
Рет қаралды 318 М.
Understanding Polymorphism with C++ | OOP Lecture
1:43:16
LEVY DEFEATS 3120 ELO HANS NIEMANN
9:16
Gotham Games
Рет қаралды 116 М.
OMG😳 #tiktok #shorts #potapova_blog
00:58
Potapova_blog
Рет қаралды 4,3 МЛН