Having hard time understanding OOP
Having hard time understanding OOP
|
|
Jun 1 2025, 08:37 PM, updated 7 months ago
Show posts by this member only | Post
#1
|
![]()
Newbie
18 posts Joined: Feb 2017 |
can anyone give me example ,i seem to struggle with understanding Object Oriented Programming . pening lalat woo
|
|
|
|
|
|
Jun 1 2025, 09:19 PM
Show posts by this member only | IPv6 | Post
#2
|
![]() ![]() ![]() ![]() ![]() ![]()
Senior Member
1,974 posts Joined: Dec 2011 |
ChatGPT Gemini can help EncikSejati liked this post
|
|
|
Jun 1 2025, 10:20 PM
Show posts by this member only | Post
#3
|
![]()
Newbie
18 posts Joined: Feb 2017 |
|
|
|
Jun 2 2025, 08:34 PM
Show posts by this member only | Post
#4
|
![]() ![]() ![]()
Junior Member
355 posts Joined: Aug 2021 |
QUOTE(EncikSejati @ Jun 1 2025, 08:37 PM) can anyone give me example ,i seem to struggle with understanding Object Oriented Programming . pening lalat woo everyone learning preference are different.some people may need to do a lot of practice, from the code and result to understand the concept, some other need to understand the concept, then start to read / code to understand how to make it work. in short, either read a lot, or type a lot, or both. This post has been edited by flashang: Jun 2 2025, 08:39 PM |
|
|
Jun 2 2025, 08:39 PM
Show posts by this member only | IPv6 | Post
#5
|
![]() ![]() ![]() ![]()
Junior Member
606 posts Joined: Oct 2014 |
What book are you reading to learn OOP? And which programming language?
|
|
|
Jun 4 2025, 01:54 PM
Show posts by this member only | Post
#6
|
![]() ![]() ![]() ![]() ![]() ![]() ![]()
Senior Member
2,353 posts Joined: Apr 2009 |
Look for the example of the 4 principles of OOP in the language u understand, it's hard to understand the essence by just reading the theory EncikSejati liked this post
|
|
|
|
|
|
Jun 7 2025, 12:01 AM
Show posts by this member only | Post
#7
|
|
Elite
965 posts Joined: Jan 2003 From: Kajang |
Think of raw construction materials, like wood, sand or rocks. Used as-is, we can maybe whip up a basic shelter like a hut.
Take some sand, cement, water and pour it into a rectangular mould. We've Encapsulated those materials into a standard unit, a brick. The shape and size of the brick is independent from the material it is made of. The brick is an Abstraction. Now we can make straight, tall walls for a house. Perhaps the sand brick is too weak to build over a certain height, or looks ugly. Mix in some stone, or use clay, but keep the same mould dimensions. The new bricks Inherit the dimensions of the original brick but have different properties such as strength, or may be more expensive (or cheaper). Because the dimensions of the brick are the same we can use the bricks interchangeably to achieve the desired strength, aesthetics, or cost target for our wall. They exhibit Polymorphism. Now, recall the usual programming 101 material such as variables, functions, if-else statements, for-loops, whiles or do-whiles, etc. Those are the raw materials that we use as programmers. |
|
|
Jun 7 2025, 03:42 PM
Show posts by this member only | Post
#8
|
|
Elite
4,956 posts Joined: Jan 2003 |
Exactly what is it about OOP that you find it hard to understand?
|
|
|
Jun 12 2025, 04:19 PM
Show posts by this member only | Post
#9
|
![]() ![]()
Junior Member
237 posts Joined: Nov 2017 |
Sometimes it easier to understand if you start to implement what you read/learn. Try to develop a simple projects such as daily journal or some calculation related projects. Use those Ai to guide you through this process. Then try to implement what you learned earlier. EncikSejati liked this post
|
|
|
Jul 16 2025, 11:33 PM
Show posts by this member only | IPv6 | Post
#10
|
![]() ![]()
Junior Member
63 posts Joined: Aug 2020 |
QUOTE(silkworm @ Jun 7 2025, 12:01 AM) Think of raw construction materials, like wood, sand or rocks. Used as-is, we can maybe whip up a basic shelter like a hut. Great example Take some sand, cement, water and pour it into a rectangular mould. We've Encapsulated those materials into a standard unit, a brick. The shape and size of the brick is independent from the material it is made of. The brick is an Abstraction. Now we can make straight, tall walls for a house. Perhaps the sand brick is too weak to build over a certain height, or looks ugly. Mix in some stone, or use clay, but keep the same mould dimensions. The new bricks Inherit the dimensions of the original brick but have different properties such as strength, or may be more expensive (or cheaper). Because the dimensions of the brick are the same we can use the bricks interchangeably to achieve the desired strength, aesthetics, or cost target for our wall. They exhibit Polymorphism. Now, recall the usual programming 101 material such as variables, functions, if-else statements, for-loops, whiles or do-whiles, etc. Those are the raw materials that we use as programmers. |
|
|
Jul 18 2025, 11:27 AM
Show posts by this member only | IPv6 | Post
#11
|
![]() ![]() ![]() ![]()
Junior Member
623 posts Joined: Sep 2008 |
the simple example to easy understand.
proton car. car is class and proton is object. |
|
|
Jul 18 2025, 12:25 PM
Show posts by this member only | IPv6 | Post
#12
|
|
Elite
965 posts Joined: Jan 2003 From: Kajang |
QUOTE(otai_g @ Jul 18 2025, 11:27 AM) Almost. You could say that, "A red Proton Saga with half a tank of petrol, 79000 km on the odometer, half-worn GoodYear tyres, going at 90km/h on the PLUS highway", is an object of the Car class.This post has been edited by silkworm: Jul 18 2025, 05:29 PM otai_g liked this post
|
| Change to: | 0.0192sec
0.56
5 queries
GZIP Disabled
Time is now: 15th December 2025 - 08:38 PM |